mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:10:54 +08:00
removed apply() Collection method. Added new mapMethods() Collection method, which is used internally to map node methods to collection methods
This commit is contained in:
@@ -156,12 +156,14 @@ Test.Modules.CONTAINER = {
|
||||
|
||||
test(shapes.length === 2, 'shapes array should have 2 elements');
|
||||
|
||||
shapes.apply('setX', 200);
|
||||
shapes.each(function(node) {
|
||||
node.setX(200);
|
||||
});
|
||||
|
||||
layer.draw();
|
||||
|
||||
shapes.each(function() {
|
||||
test(this.getX() === 200, 'shape x should be 200');
|
||||
shapes.each(function(node) {
|
||||
test(node.getX() === 200, 'shape x should be 200');
|
||||
});
|
||||
},
|
||||
'set fill on array by Shape-selector': function(containerId) {
|
||||
@@ -200,12 +202,14 @@ Test.Modules.CONTAINER = {
|
||||
|
||||
test(shapes.length === 2, 'shapes array should have 2 elements');
|
||||
|
||||
shapes.apply('setFill', 'gray');
|
||||
shapes.each(function(node) {
|
||||
node.setFill('gray');
|
||||
});
|
||||
|
||||
layer.draw();
|
||||
|
||||
shapes.each(function() {
|
||||
test(this.getFill() === 'gray', 'shape x should be 200');
|
||||
shapes.each(function(node) {
|
||||
test(node.getFill() === 'gray', 'shape x should be 200');
|
||||
});
|
||||
},
|
||||
'add listener to an array of nodes': function(containerId) {
|
||||
|
@@ -2116,7 +2116,9 @@ Test.Modules.NODE = {
|
||||
|
||||
var stage = Kinetic.Node.create(json, containerId);
|
||||
|
||||
stage.get('#myTriangle').apply('setDrawFunc', drawTriangle);
|
||||
stage.get('#myTriangle').each(function(node) {
|
||||
node.setDrawFunc(drawTriangle);
|
||||
});
|
||||
|
||||
stage.draw();
|
||||
|
||||
@@ -2157,7 +2159,9 @@ Test.Modules.NODE = {
|
||||
var stage = Kinetic.Node.create(json, containerId);
|
||||
|
||||
testJSON(stage.toJSON(), json, 'problem loading stage json with image');
|
||||
stage.get('#darth').apply('setImage', imageObj);
|
||||
stage.get('#darth').each(function(node) {
|
||||
node.setImage(imageObj);
|
||||
});
|
||||
stage.draw();
|
||||
};
|
||||
imageObj.src = '../assets/darth-vader.jpg';
|
||||
|
Reference in New Issue
Block a user