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

@ -16,42 +16,38 @@
* limitations under the License. * limitations under the License.
*/ */
Grid = function(parent, colums, rows) Grid = function (parent, colums, rows) {
{
var cellSize = "10px"; var cellSize = "10px";
this._parent = parent; this._parent = parent;
this._container = this._createContainer(); this._container = this._createContainer();
var tbody = this._container.firstChild.firstChild; var tbody = $(this._container.firstChild.firstChild);
for (var i = 0; i < rows; i++) for (var i = 0; i < rows; i++) {
{ var trElement = $('<tr></tr>');
var trElement = document.createElement("tr"); for (var j = 0; j < colums; j++) {
for (var j = 0; j < colums; j++) var tdElement = $('<td></td>');
{ tdElement.css({
var tdElement = document.createElement("td"); width: cellSize,
tdElement.style.width = cellSize; height: cellSize,
tdElement.style.height = cellSize; borderWidth: "1px",
tdElement.style.borderWidth = "1px"; borderStyle: "dashed",
tdElement.style.borderStyle = "dashed"; borderColor: "lightsteelblue"}
tdElement.style.borderColor = "lightsteelblue"; );
trElement.append(tdElement); trElement.append(tdElement);
} }
tbody.append(trElement); tbody.append(trElement);
} }
}; };
Grid.prototype.setPosition = function(x, y) Grid.prototype.setPosition = function (x, y) {
{
this._container.style.left = x; this._container.style.left = x;
this._container.style.top = y; this._container.style.top = y;
}; };
Grid.prototype.render = function() Grid.prototype.render = function () {
{ $(this._parent).append(this._container);
this._parent.append(this._container);
}; };
Grid.prototype._createContainer = function() Grid.prototype._createContainer = function () {
{
var result = window.document.createElement("div"); var result = window.document.createElement("div");
result.style.tableLayout = "fixed"; result.style.tableLayout = "fixed";
result.style.borderCollapse = "collapse"; result.style.borderCollapse = "collapse";

View File

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