diff --git a/lime/src/node.js b/lime/src/node.js index cc70a243..05261cec 100644 --- a/lime/src/node.js +++ b/lime/src/node.js @@ -632,8 +632,7 @@ lime.Node.prototype.createDomElement = function() { var newTagName = this.renderer.getType() == lime.Renderer.CANVAS ? 'canvas' : 'div'; var create = function() { - this.domElement = this.rootElement = - this.containerElement = goog.dom.createDom(newTagName); + this.domElement = this.rootElement = goog.dom.createDom(newTagName); if (this.domClassName) goog.dom.classes.add(this.domElement, this.domClassName); this.dirty_ |= ~0; @@ -677,7 +676,6 @@ lime.Node.prototype.removeDomElement = function() { goog.dom.removeNode(this.rootElement); delete this.domElement; delete this.rootElement; - delete this.containerElement; //return true; } }; @@ -734,9 +732,6 @@ lime.Node.prototype.update = function(opt_pass) { delete this.transitionsActiveSet_[i]; property = lime.Node.getPropertyForTransition(parseInt(i, 10)); lime.style.clearTransition(this.domElement, property); - if (this.domElement != this.containerElement) { - lime.style.clearTransition(this.continerElement, property); - } } // predraw is a check that elements are correctly drawn before the @@ -786,14 +781,6 @@ lime.Node.prototype.update = function(opt_pass) { this.transitionsActive_[i] = value[0]; lime.style.setTransition(this.domElement, property, value[1], value[2]); - - if (this.domElement != this.containerElement && - property == lime.style.transformProperty) { - - lime.style.setTransition(this.containerElement, - property, value[1], value[2]); - - } } delete this.transitionsAdd_[i]; } diff --git a/lime/src/renderer/dom.js b/lime/src/renderer/dom.js index c13cdf51..93d223b0 100644 --- a/lime/src/renderer/dom.js +++ b/lime/src/renderer/dom.js @@ -26,17 +26,17 @@ lime.Renderer.DOM.updateLayout = function() { continue; } else { - if (goog.dom.contains(this.containerElement, el)) { + if (goog.dom.contains(this.domElement, el)) { goog.dom.removeNode(el); } - lime.Renderer.DOM.appendAt_(this.containerElement, el, j++); + lime.Renderer.DOM.appendAt_(this.domElement, el, j++); continue; } } - /* var lastIndex = this.containerElement.childNodes.length - 1; + /* var lastIndex = this.domElement.childNodes.length - 1; while (lastIndex >= j) { - goog.dom.removeNode(this.containerElement.childNodes[lastIndex]); + goog.dom.removeNode(this.domElement.childNodes[lastIndex]); lastIndex--; }*/ }; @@ -73,20 +73,23 @@ lime.Renderer.DOM.drawSizePosition = function () { var px = position.x - ax, py = position.y - ay; - var so = this.stroke_ ? this.stroke_.width_ : 0; + // --- BEGIN: Translate to account for Parent AnchorPoint + var parentAnchorX = 0; + var parentAnchorY = 0; - if (((ax-so) != 0 || (ay-so) != 0) && this.domElement == this.containerElement && - this.children_.length) { - lime.Renderer.DOM.makeContainer.call(this); - } + var parent = this.getParent(); + + if (parent) { + var parentAnchor = parent.getAnchorPoint(); + var parentSize = parent.getSize(); + + parentAnchorX = parentAnchor.x * parentSize.width; + parentAnchorY = parentAnchor.y * parentSize.height; - if (this.domElement != this.containerElement) { - if (!this.transitionsActiveSet_[lime.Transition.POSITION] && !this.transitionsActiveSet_[lime.Transition.SCALE] && !this.transitionsActiveSet_[lime.Transition.ROTATION]) - lime.style.setTransform(this.containerElement, - new lime.style.Transform() - .set3DAllowed(enable3D) - .translate(ax-so, ay-so)); + px += parentAnchorX; + py += parentAnchorY; } + // --- END: Translate if (this.mask_ != this.activeMask_) { if (this.activeMask_) { @@ -236,22 +239,6 @@ lime.Renderer.DOM.appendAt_ = function(p, c, opt_pos) { p.insertBefore(c, p.childNodes[opt_pos]); }; -/** - * Make separate container element for the childnodes - * @this {lime.Node} - */ -lime.Renderer.DOM.makeContainer = function() { - this.containerElement = goog.dom.createDom('div'); - var fragment = document.createDocumentFragment(), - child; - while ((child = this.domElement.firstChild)) { - this.domElement.removeChild(child); - fragment.appendChild(child); - } - this.containerElement.appendChild(fragment); - this.domElement.appendChild(this.containerElement); -}; - /** * Remove mask element relations * @thisĀ {lime.Node}