Skip to content

Commit

Permalink
Fixed post-render Node events
Browse files Browse the repository at this point in the history
Generalised Socket messages
Reversed Text X-axis direction
  • Loading branch information
xeolabs committed Aug 21, 2010
1 parent 3e3fd60 commit b23f636
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/scenejs/geometry/text/vectorTextModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ SceneJS._vectorTextModule = new (function() {
continue;
}

geo.positions.push(x + a[0] * mag);
geo.positions.push(x + a[0] * -mag);
geo.positions.push(y + a[1] * mag);
geo.positions.push(0);

Expand All @@ -1486,7 +1486,7 @@ SceneJS._vectorTextModule = new (function() {
}
needLine = true;
}
x += c.width * mag;
x -= c.width * mag;

}
y -= 25 * mag;
Expand Down
49 changes: 25 additions & 24 deletions src/scenejs/node/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,34 +595,35 @@ SceneJS.Node.prototype._applyConfigs = function(configs, configsModes, node, dat
* Wraps _render to fire built-in events either side of rendering.
* @private */
SceneJS.Node.prototype._renderWithEvents = function(traversalContext, data) {
SceneJS._nodeEventsModule.preVisitNode(this);
this._processEventsIn();
try {
SceneJS._nodeEventsModule.preVisitNode(this);
this._processEventsIn();

/* Apply any configs that were pushed into this node in a "configure" event. We'll also
* apply any sub-configs within those to children as we descend into those, then forget the
* configs when we leave this method so we don't keep re-applying them
*/
if (this._configs) {
this._applyConfigs(this._configs, traversalContext.configsModes, this, data);
}

if (this._numListeners == 0) {
this._render(traversalContext, data);
} else {
if (this._listeners["rendering"]) {
this._fireEvent("rendering", { });
/* Apply any configs that were pushed into this node in a "configure" event. We'll also
* apply any sub-configs within those to children as we descend into those, then forget the
* configs when we leave this method so we don't keep re-applying them
*/
if (this._configs) {
this._applyConfigs(this._configs, traversalContext.configsModes, this, data);
}
this._render(traversalContext, data);
if (this._listeners["rendered"]) {
this._fireEvent("rendered", { });

if (this._numListeners == 0) {
this._render(traversalContext, data);
} else {
if (this._listeners["rendering"]) {
this._fireEvent("rendering", { });
}
this._render(traversalContext, data);
if (this._listeners["rendered"]) {
this._fireEvent("rendered", { });
}
}
}
this._flushEventsOut();
SceneJS._nodeEventsModule.postVisitNode(this);
this._flushEventsOut();
SceneJS._nodeEventsModule.postVisitNode(this);

/* Forget any configs we applied
*/
if (this._configs) {
/* Forget any configs we applied - make sure we do this if they threw an exception
*/
} finally {
this._configs = null;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/scenejs/socket/socketModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ SceneJS._SocketModule = new (function() {
}
var messageObj = eval('(' + messageStr + ')');
inQueue.pop(); // Evaled OK, can pop now
onSuccess(messageObj.body);
onSuccess(messageObj);
} catch (e) {
onError(new SceneJS.errors.SocketErrorException
("SceneJS.Socket error reading message (from server at URI: '" + activeSocket.uri + "') : " + e));
Expand Down

0 comments on commit b23f636

Please sign in to comment.