Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhitman <bryan@olenepal.org>2009-09-09 11:28:46 (GMT)
committer hitman <bryan@olenepal.org>2009-09-09 11:28:46 (GMT)
commit0397fae80f5bd6355f4378a5d69db1e79cab6933 (patch)
treeeca4ab788b9468fdbec8283de56d71052547d53e
parent0b2f5792313b5cd2a439f34cf130b185ba74c307 (diff)
fixed bug that overwrote surface id specified in k.init w/ the id
attribute of the canvas element
-rwxr-xr-xexamples/adding_up_to_10/js/lesson.js8
-rwxr-xr-xjs/jquery.karma.js14
2 files changed, 12 insertions, 10 deletions
diff --git a/examples/adding_up_to_10/js/lesson.js b/examples/adding_up_to_10/js/lesson.js
index bf54fd3..0974180 100755
--- a/examples/adding_up_to_10/js/lesson.js
+++ b/examples/adding_up_to_10/js/lesson.js
@@ -10,10 +10,8 @@ $(document).ready(function(){
{id: "chilli", file: "chilli.png", localized : false },
{id: "fish" , file: "fish64px.png", localized : false },
{id: "flower", file: "flower37px.png", localized : false },
- {id: "normalChimp", file: "normalChimp_120x125.png",
- localized : false},
- {id: "happyChimp", file: "happyChimp_120x125.png",
- localized : false},
+ {id: "normalChimp", file: "normalChimp_120x125.png", localized : false},
+ {id: "happyChimp", file: "happyChimp_120x125.png", localized: false},
{id: "sadChimp", file: "sadChimp_120x125.png", localized : false}
]
,
@@ -128,7 +126,7 @@ k.main(function() {
y = k.math.rand( 0, d );
for ( var j=0; j<pos.length; j++) {
if ( k.geometry.distance2( pos[j],
- {"x": x, "y": y} ) < 160 ) {
+ {"x": x, "y": y} ) < 80 ) {
flag = true;
break;
}
diff --git a/js/jquery.karma.js b/js/jquery.karma.js
index 00016f4..bd2aead 100755
--- a/js/jquery.karma.js
+++ b/js/jquery.karma.js
@@ -640,12 +640,16 @@ var KSurface = Class(
this.canvas.id = this.id;
this.container.appendChild( this.canvas );
}else {
- this.canvas = document.getElementById( options.canvas );
- if ( !this.canvas )
- throw new Error ("The canvas id doesn't exist");
- this.width = this.canvas.width;
- this.height = this.canvas.height;
+ this.canvas = document.getElementById( options.canvas );
+ if ( !this.canvas ){
+ throw new Error ("The canvas id doesn't exist");
+ }
+ this.width = this.canvas.width;
+ this.height = this.canvas.height;
+
+ if (!this.id){
this.id = this.canvas.id;
+ }
}
if ( this.canvas.getContext ) {
this.ctx = this.canvas.getContext("2d");