mirror of
https://github.com/konvajs/konva.git
synced 2025-11-08 02:24:44 +08:00
created _getFillType utility to help manage fill type objects. You can now dynamically switch between different fill types, including colors, linear gradients, radial gradients, and patterns
This commit is contained in:
@@ -1786,7 +1786,7 @@ Test.prototype.tests = {
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
},
|
||||
'SHAPE - set image fill to color then image': function(containerId) {
|
||||
'SHAPE - set image fill to color then image then linear gradient then back to image': function(containerId) {
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function() {
|
||||
var stage = new Kinetic.Stage({
|
||||
@@ -1817,7 +1817,27 @@ Test.prototype.tests = {
|
||||
test(circle.getFill().repeat === 'no-repeat', 'circle fill repeat should be no-repeat');
|
||||
test(circle.getFill().offset.x === -200, 'circle fill offset x should be -200');
|
||||
test(circle.getFill().offset.y === -70, 'circle fill offset y should be -70');
|
||||
|
||||
|
||||
circle.setFill({
|
||||
start: {
|
||||
x: -35,
|
||||
y: -35
|
||||
},
|
||||
end: {
|
||||
x: 35,
|
||||
y: 35
|
||||
},
|
||||
colorStops: [0, 'red', 1, 'blue']
|
||||
});
|
||||
|
||||
test(circle.getFill().image === undefined, 'circle fill image should be undefined');
|
||||
|
||||
circle.setFill({
|
||||
image: imageObj,
|
||||
repeat: 'no-repeat',
|
||||
offset: [-200, -70]
|
||||
});
|
||||
|
||||
layer.draw();
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
@@ -4607,6 +4627,15 @@ Test.prototype.tests = {
|
||||
|
||||
layer.draw();
|
||||
},
|
||||
'STAGE - test stage.getStage()': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
|
||||
console.log(stage.getStage());
|
||||
},
|
||||
'LAYERING - move blue layer on top of green layer with moveToTop': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
||||
Reference in New Issue
Block a user