Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removecontainernode #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions lime/src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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];
}
Expand Down
49 changes: 18 additions & 31 deletions lime/src/renderer/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
}*/
};
Expand Down Expand Up @@ -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_) {
Expand Down Expand Up @@ -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}
Expand Down