Fix workspace.

This commit is contained in:
Paulo Gustavo Veiga 2014-03-04 21:33:47 -03:00
parent 1580d20e31
commit 0d0db68038
2 changed files with 40 additions and 44 deletions

View File

@ -1,57 +1,53 @@
/*
* Copyright [2012] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2012] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Grid = function(parent, colums, rows)
{
Grid = function (parent, colums, rows) {
var cellSize = "10px";
this._parent = parent;
this._container = this._createContainer();
var tbody = this._container.firstChild.firstChild;
for (var i = 0; i < rows; i++)
{
var trElement = document.createElement("tr");
for (var j = 0; j < colums; j++)
{
var tdElement = document.createElement("td");
tdElement.style.width = cellSize;
tdElement.style.height = cellSize;
tdElement.style.borderWidth = "1px";
tdElement.style.borderStyle = "dashed";
tdElement.style.borderColor = "lightsteelblue";
var tbody = $(this._container.firstChild.firstChild);
for (var i = 0; i < rows; i++) {
var trElement = $('<tr></tr>');
for (var j = 0; j < colums; j++) {
var tdElement = $('<td></td>');
tdElement.css({
width: cellSize,
height: cellSize,
borderWidth: "1px",
borderStyle: "dashed",
borderColor: "lightsteelblue"}
);
trElement.append(tdElement);
}
tbody.append(trElement);
}
};
Grid.prototype.setPosition = function(x, y)
{
Grid.prototype.setPosition = function (x, y) {
this._container.style.left = x;
this._container.style.top = y;
};
Grid.prototype.render = function()
{
this._parent.append(this._container);
Grid.prototype.render = function () {
$(this._parent).append(this._container);
};
Grid.prototype._createContainer = function()
{
Grid.prototype._createContainer = function () {
var result = window.document.createElement("div");
result.style.tableLayout = "fixed";
result.style.borderCollapse = "collapse";

View File

@ -73,7 +73,7 @@
var x = 100;
var executer = function () {
x = (x + 10) % 100;
divElem.style.left = x + "px";
divElem.css('left', x + "px");
};
executer.periodical(100);
@ -136,13 +136,13 @@
};
var workspace100x100 = coordSizeSampleBuilder(100, 100);
workspace100x100.addItAsChildTo(document.id("coordsizeExample100x100"));
workspace100x100.addItAsChildTo($("#coordsizeExample100x100"));
var workspace100x200 = coordSizeSampleBuilder(100, 200);
workspace100x200.addItAsChildTo(document.id("coordsizeExample100x200"));
workspace100x200.addItAsChildTo($("#coordsizeExample100x200"));
var workspace200x100 = coordSizeSampleBuilder(200, 100);
workspace200x100.addItAsChildTo(document.id("coordsizeExample200x100"));
workspace200x100.addItAsChildTo($("#coordsizeExample200x100"));
var dynamicWorkspace = coordSizeSampleBuilder(100, 100);
dynamicWorkspace.addItAsChildTo($('#coordsizeExampleDynamic'));
@ -200,13 +200,13 @@
};
var workspace0x0 = coordOriginSampleBuilder(0, 0);
workspace0x0.addItAsChildTo(document.id("coordorigin0x0"));
workspace0x0.addItAsChildTo($("#coordorigin0x0"));
var workspace0x50 = coordOriginSampleBuilder(0, 50);
workspace0x50.addItAsChildTo(document.id("coordorigin0x50"));
workspace0x50.addItAsChildTo($("#coordorigin0x50"));
var workspace50x0 = coordOriginSampleBuilder(50, 0);
workspace50x0.addItAsChildTo(document.id("coordorigin50x0"));
workspace50x0.addItAsChildTo($("#coordorigin50x0"));
// Workspace animation changing the coordsize from (30,30) to (100,100)
var dynamicWorkspace = coordOriginSampleBuilder(100, 100);