forgot to move the image object to the attrs for Kinetic.Image and Kinetic.Sprite

This commit is contained in:
Eric Rowell
2012-05-20 21:41:05 -07:00
parent 61d325d383
commit 5526d2847e
4 changed files with 20 additions and 20 deletions

18
dist/kinetic-core.js vendored
View File

@@ -3086,9 +3086,9 @@ Kinetic.Image = function(config) {
this.shapeType = "Image";
config.drawFunc = function() {
if(this.image !== undefined) {
var width = this.attrs.width !== undefined ? this.attrs.width : this.image.width;
var height = this.attrs.height !== undefined ? this.attrs.height : this.image.height;
if(this.attrs.image !== undefined) {
var width = this.attrs.width !== undefined ? this.attrs.width : this.attrs.image.width;
var height = this.attrs.height !== undefined ? this.attrs.height : this.attrs.image.height;
var cropX = this.attrs.crop.x;
var cropY = this.attrs.crop.y;
var cropWidth = this.attrs.crop.width;
@@ -3103,11 +3103,11 @@ Kinetic.Image = function(config) {
// if cropping
if(cropWidth !== undefined && cropHeight !== undefined) {
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
context.drawImage(this.attrs.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
}
// no cropping
else {
context.drawImage(this.image, 0, 0, width, height);
context.drawImage(this.attrs.image, 0, 0, width, height);
}
}
};
@@ -3123,13 +3123,13 @@ Kinetic.Image.prototype = {
* @param {ImageObject} image
*/
setImage: function(image) {
this.image = image;
this.attrs.image = image;
},
/**
* get image
*/
getImage: function() {
return this.image;
return this.attrs.image;
},
/**
* set width
@@ -3214,7 +3214,7 @@ Kinetic.Sprite = function(config) {
});
config.drawFunc = function() {
if(this.image !== undefined) {
if(this.attrs.image !== undefined) {
var context = this.getContext();
var anim = this.attrs.animation;
var index = this.attrs.index;
@@ -3223,7 +3223,7 @@ Kinetic.Sprite = function(config) {
context.beginPath();
context.rect(0, 0, f.width, f.height);
context.closePath();
context.drawImage(this.image, f.x, f.y, f.width, f.height, 0, 0, f.width, f.height);
context.drawImage(this.attrs.image, f.x, f.y, f.width, f.height, 0, 0, f.width, f.height);
}
};
// call super constructor

File diff suppressed because one or more lines are too long

View File

@@ -19,9 +19,9 @@ Kinetic.Image = function(config) {
this.shapeType = "Image";
config.drawFunc = function() {
if(this.image !== undefined) {
var width = this.attrs.width !== undefined ? this.attrs.width : this.image.width;
var height = this.attrs.height !== undefined ? this.attrs.height : this.image.height;
if(this.attrs.image !== undefined) {
var width = this.attrs.width !== undefined ? this.attrs.width : this.attrs.image.width;
var height = this.attrs.height !== undefined ? this.attrs.height : this.attrs.image.height;
var cropX = this.attrs.crop.x;
var cropY = this.attrs.crop.y;
var cropWidth = this.attrs.crop.width;
@@ -36,11 +36,11 @@ Kinetic.Image = function(config) {
// if cropping
if(cropWidth !== undefined && cropHeight !== undefined) {
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
context.drawImage(this.attrs.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
}
// no cropping
else {
context.drawImage(this.image, 0, 0, width, height);
context.drawImage(this.attrs.image, 0, 0, width, height);
}
}
};
@@ -56,13 +56,13 @@ Kinetic.Image.prototype = {
* @param {ImageObject} image
*/
setImage: function(image) {
this.image = image;
this.attrs.image = image;
},
/**
* get image
*/
getImage: function() {
return this.image;
return this.attrs.image;
},
/**
* set width

View File

@@ -14,7 +14,7 @@ Kinetic.Sprite = function(config) {
});
config.drawFunc = function() {
if(this.image !== undefined) {
if(this.attrs.image !== undefined) {
var context = this.getContext();
var anim = this.attrs.animation;
var index = this.attrs.index;
@@ -23,7 +23,7 @@ Kinetic.Sprite = function(config) {
context.beginPath();
context.rect(0, 0, f.width, f.height);
context.closePath();
context.drawImage(this.image, f.x, f.y, f.width, f.height, 0, 0, f.width, f.height);
context.drawImage(this.attrs.image, f.x, f.y, f.width, f.height, 0, 0, f.width, f.height);
}
};
// call super constructor