mirror of
https://github.com/konvajs/konva.git
synced 2025-12-04 19:08:24 +08:00
added getSize() method to Stage, Rect, and Image. Also updated unit tests
This commit is contained in:
@@ -109,7 +109,7 @@ Kinetic.GlobalObject = {
|
||||
return 2.5 + b * transition.time;
|
||||
});
|
||||
break;
|
||||
// linear is default
|
||||
// none is default
|
||||
default:
|
||||
this._transitionPow(transition, key, prop, function() {
|
||||
return 1;
|
||||
|
||||
@@ -428,8 +428,8 @@ Kinetic.Node.prototype = {
|
||||
* radius, scale.x, scale.y, centerOffset.x, centerOffset.y, etc.
|
||||
* @param {Object} config
|
||||
* @config {Number} [duration] duration that the transition runs in seconds
|
||||
* @config {String} [easing] easing function. can be linear, ease-in, ease-out, or ease-in-out.
|
||||
* linear is the default
|
||||
* @config {String} [easing] easing function. can be none, ease-in, ease-out, or ease-in-out.
|
||||
* none is the default
|
||||
* @config {Function} [callback] callback function to be executed when
|
||||
* transition completes
|
||||
*/
|
||||
|
||||
@@ -120,6 +120,15 @@ Kinetic.Stage.prototype = {
|
||||
this.backstageLayer.getCanvas().width = width;
|
||||
this.backstageLayer.getCanvas().height = height;
|
||||
},
|
||||
/**
|
||||
* return stage size
|
||||
*/
|
||||
getSize: function() {
|
||||
return {
|
||||
width: this.width,
|
||||
height: this.height
|
||||
};
|
||||
},
|
||||
/**
|
||||
* clear all layers
|
||||
*/
|
||||
|
||||
@@ -80,6 +80,15 @@ Kinetic.Image.prototype = {
|
||||
setSize: function(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
},
|
||||
/**
|
||||
* return image size
|
||||
*/
|
||||
getSize: function() {
|
||||
return {
|
||||
width: this.width,
|
||||
height: this.height
|
||||
};
|
||||
}
|
||||
};
|
||||
// extend Shape
|
||||
|
||||
@@ -57,6 +57,15 @@ Kinetic.Rect.prototype = {
|
||||
setSize: function(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
},
|
||||
/**
|
||||
* return rect size
|
||||
*/
|
||||
getSize: function() {
|
||||
return {
|
||||
width: this.width,
|
||||
height: this.height
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user