mirror of
https://github.com/konvajs/konva.git
synced 2025-09-22 20:14:01 +08:00
forgot to move the image object to the attrs for Kinetic.Image and Kinetic.Sprite
This commit is contained in:
18
dist/kinetic-core.js
vendored
18
dist/kinetic-core.js
vendored
@@ -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
|
||||
|
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user