mirror of
https://github.com/konvajs/konva.git
synced 2025-11-18 09:07:30 +08:00
added support for heigt and width properties inside an object config property to be transition-able
This commit is contained in:
11
dist/kinetic-core.js
vendored
11
dist/kinetic-core.js
vendored
@@ -3048,7 +3048,7 @@ Kinetic.Image = function(config) {
|
|||||||
this.applyStyles();
|
this.applyStyles();
|
||||||
|
|
||||||
// if cropping
|
// if cropping
|
||||||
if(cropWidth !== undefined && cropHeight !== undefined) {
|
if(cropWidth !== undefined && cropHeight !== undefined) {
|
||||||
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
|
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
// no cropping
|
// no cropping
|
||||||
@@ -4025,15 +4025,22 @@ Kinetic.Transition = function(node, config) {
|
|||||||
// add tween for each property
|
// add tween for each property
|
||||||
for(var key in config) {
|
for(var key in config) {
|
||||||
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
||||||
if(config[key].x === undefined && config[key].y === undefined) {
|
if(config[key].x === undefined && config[key].y === undefined && config[key].width === undefined && config[key].height === undefined) {
|
||||||
this.add(this._getTween(key, config));
|
this.add(this._getTween(key, config));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config[key].x !== undefined) {
|
if(config[key].x !== undefined) {
|
||||||
this.add(this._getComponentTween(key, 'x', config));
|
this.add(this._getComponentTween(key, 'x', config));
|
||||||
}
|
}
|
||||||
if(config[key].y !== undefined) {
|
if(config[key].y !== undefined) {
|
||||||
this.add(this._getComponentTween(key, 'y', config));
|
this.add(this._getComponentTween(key, 'y', config));
|
||||||
}
|
}
|
||||||
|
if(config[key].width !== undefined) {
|
||||||
|
this.add(this._getComponentTween(key, 'width', config));
|
||||||
|
}
|
||||||
|
if(config[key].height !== undefined) {
|
||||||
|
this.add(this._getComponentTween(key, 'height', config));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -35,7 +35,7 @@ Kinetic.Image = function(config) {
|
|||||||
this.applyStyles();
|
this.applyStyles();
|
||||||
|
|
||||||
// if cropping
|
// if cropping
|
||||||
if(cropWidth !== undefined && cropHeight !== undefined) {
|
if(cropWidth !== undefined && cropHeight !== undefined) {
|
||||||
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
|
context.drawImage(this.image, cropX, cropY, cropWidth, cropHeight, 0, 0, width, height);
|
||||||
}
|
}
|
||||||
// no cropping
|
// no cropping
|
||||||
|
|||||||
@@ -17,15 +17,22 @@ Kinetic.Transition = function(node, config) {
|
|||||||
// add tween for each property
|
// add tween for each property
|
||||||
for(var key in config) {
|
for(var key in config) {
|
||||||
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
if(key !== 'duration' && key !== 'easing' && key !== 'callback') {
|
||||||
if(config[key].x === undefined && config[key].y === undefined) {
|
if(config[key].x === undefined && config[key].y === undefined && config[key].width === undefined && config[key].height === undefined) {
|
||||||
this.add(this._getTween(key, config));
|
this.add(this._getTween(key, config));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config[key].x !== undefined) {
|
if(config[key].x !== undefined) {
|
||||||
this.add(this._getComponentTween(key, 'x', config));
|
this.add(this._getComponentTween(key, 'x', config));
|
||||||
}
|
}
|
||||||
if(config[key].y !== undefined) {
|
if(config[key].y !== undefined) {
|
||||||
this.add(this._getComponentTween(key, 'y', config));
|
this.add(this._getComponentTween(key, 'y', config));
|
||||||
}
|
}
|
||||||
|
if(config[key].width !== undefined) {
|
||||||
|
this.add(this._getComponentTween(key, 'width', config));
|
||||||
|
}
|
||||||
|
if(config[key].height !== undefined) {
|
||||||
|
this.add(this._getComponentTween(key, 'height', config));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1019,6 +1019,18 @@ Test.prototype.tests = {
|
|||||||
test(crop.y === 20, 'crop y should be 20');
|
test(crop.y === 20, 'crop y should be 20');
|
||||||
test(crop.width === 200, 'crop width should be 200');
|
test(crop.width === 200, 'crop width should be 200');
|
||||||
test(crop.height === 250, 'crop height should be 250');
|
test(crop.height === 250, 'crop height should be 250');
|
||||||
|
|
||||||
|
/*
|
||||||
|
darth.transitionTo({
|
||||||
|
crop: {
|
||||||
|
|
||||||
|
width: 100,
|
||||||
|
height: 125
|
||||||
|
|
||||||
|
},
|
||||||
|
duration: 1
|
||||||
|
});
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
imageObj.src = '../darth-vader.jpg';
|
imageObj.src = '../darth-vader.jpg';
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user