Skip to content

Commit

Permalink
Fix rotation issue - each group needs unique toString/__repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Apr 9, 2012
1 parent cbe559d commit 66b2387
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/resources/classy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
CLASSY_VERSION = '1.4',
context = this,
old = context.Class,
disable_constructor = false;
disable_constructor = false,
object_id = 0;

/* we check if $super is in use by a class if we can. But first we have to
check if the JavaScript interpreter supports that. This also matches
Expand Down Expand Up @@ -123,6 +124,8 @@
if (disable_constructor)
return;
var proper_this = context === this ? cheapNew(arguments.callee) : this;
proper_this.$objectId = object_id;
object_id++;
proper_this.$class = rv;
if (proper_this.__init__)
proper_this.__init__.apply(proper_this, arguments);
Expand Down
4 changes: 4 additions & 0 deletions examples/rotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ require(["jsglet/core"], function(jsglet) {
unset: function() {
this.camera.popModel();
this.camera.apply();
},

__repr__: function() {
return "RotationGroup " + this.parent + " " + this.$objectId;
}
});

Expand Down
1 change: 0 additions & 1 deletion jsglet/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ define(
},

identityModel: function() {
this.modelMatrix = mat4.create();
mat4.identity(this.modelMatrix);
},

Expand Down

0 comments on commit 66b2387

Please sign in to comment.