mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 04:14:52 +08:00
refactored cache method to work better with containers and also fast layers
This commit is contained in:
50
test/unit/Group-test.js
Normal file
50
test/unit/Group-test.js
Normal file
@@ -0,0 +1,50 @@
|
||||
suite('Group', function() {
|
||||
|
||||
// ======================================================
|
||||
test('cache group with text', function() {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.Layer();
|
||||
var group = new Kinetic.Group({
|
||||
draggable : true,
|
||||
x: 100,
|
||||
y: 40
|
||||
});
|
||||
var text = new Kinetic.Text({
|
||||
text : "some text",
|
||||
fontSize: 20,
|
||||
fill: "black",
|
||||
y : 50
|
||||
});
|
||||
|
||||
var rect = new Kinetic.Rect({
|
||||
height : 100,
|
||||
width : 100,
|
||||
stroke : "#00B80C",
|
||||
strokeWidth: 10,
|
||||
cornerRadius: 1
|
||||
});
|
||||
group.add(text);
|
||||
group.add(rect);
|
||||
layer.add(group);
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
group.cache({
|
||||
x: -5,
|
||||
y: -5,
|
||||
width : 110,
|
||||
height : 110,
|
||||
drawBorder: true
|
||||
}).offsetX(5).offsetY(5);
|
||||
|
||||
stage.draw();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user