mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
image fills can now be scaled to simulate image cropping. Now that image fills can be offset and scaled, the Image Shape is now obsolute because any shape can now use regular images or cropped images.
This commit is contained in:
parent
fae1ff6cb7
commit
dc51d95eb1
3
dist/kinetic-core.js
vendored
3
dist/kinetic-core.js
vendored
@ -2914,6 +2914,9 @@ Kinetic.Shape.prototype = {
|
|||||||
|
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
|
if(fill.scale !== undefined) {
|
||||||
|
context.scale(fill.scale.x, fill.scale.y);
|
||||||
|
}
|
||||||
if(fill.offset !== undefined) {
|
if(fill.offset !== undefined) {
|
||||||
context.translate(fill.offset.x, fill.offset.y);
|
context.translate(fill.offset.x, fill.offset.y);
|
||||||
}
|
}
|
||||||
|
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
@ -127,6 +127,9 @@ Kinetic.Shape.prototype = {
|
|||||||
|
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
|
if(fill.scale !== undefined) {
|
||||||
|
context.scale(fill.scale.x, fill.scale.y);
|
||||||
|
}
|
||||||
if(fill.offset !== undefined) {
|
if(fill.offset !== undefined) {
|
||||||
context.translate(fill.offset.x, fill.offset.y);
|
context.translate(fill.offset.x, fill.offset.y);
|
||||||
}
|
}
|
||||||
|
@ -1130,7 +1130,8 @@ Test.prototype.tests = {
|
|||||||
fill: {
|
fill: {
|
||||||
image: imageObj,
|
image: imageObj,
|
||||||
repeat: 'no-repeat',
|
repeat: 'no-repeat',
|
||||||
offset: [-200, -70]
|
offset: [-200, -70],
|
||||||
|
scale: 0.7
|
||||||
},
|
},
|
||||||
stroke: 'black',
|
stroke: 'black',
|
||||||
strokeWidth: 4,
|
strokeWidth: 4,
|
||||||
|
Loading…
Reference in New Issue
Block a user