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:
Eric Rowell 2012-06-17 17:18:49 -07:00
parent fae1ff6cb7
commit dc51d95eb1
4 changed files with 10 additions and 3 deletions

View File

@ -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);
} }

File diff suppressed because one or more lines are too long

View File

@ -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);
} }

View File

@ -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,