mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
first pass at removing setDefaultAttrs logic to speed up node instantation performance
This commit is contained in:
@@ -855,6 +855,8 @@ Test.Modules.CONTAINER = {
|
||||
stage.add(greenLayer);
|
||||
|
||||
blueLayer.setZIndex(1);
|
||||
|
||||
console.log(greenLayer.getZIndex());
|
||||
|
||||
test(greenLayer.getZIndex() === 0, 'green layer should have z index of 0');
|
||||
test(blueLayer.getZIndex() === 1, 'blue layer should have z index of 1');
|
||||
|
@@ -21,13 +21,13 @@ Test.Modules.DD = {
|
||||
layer.draw();
|
||||
|
||||
// test defaults
|
||||
test(circle.attrs.draggable === false, 'draggable should be false');
|
||||
test(circle.isDraggable() === false, 'draggable should be false');
|
||||
|
||||
//change properties
|
||||
circle.setDraggable(true);
|
||||
|
||||
// test new properties
|
||||
test(circle.attrs.draggable === true, 'draggable should be true');
|
||||
test(circle.getDraggable() === true, 'draggable should be true');
|
||||
},
|
||||
'DRAG AND DROP - multiple drag and drop sets with setDraggable()': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
|
@@ -852,7 +852,7 @@ Test.Modules.NODE = {
|
||||
|
||||
showHit(layer);
|
||||
},
|
||||
'hide group': function(containerId) {
|
||||
'hide group 2': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
@@ -2611,6 +2611,9 @@ Test.Modules.NODE = {
|
||||
|
||||
layer.hide();
|
||||
layer.draw();
|
||||
|
||||
console.log(layer.toDataURL());
|
||||
|
||||
test(layer.toDataURL() === dataUrls['cleared'], 'layer is still visible');
|
||||
},
|
||||
'hide group': function(containerId) {
|
||||
|
@@ -561,7 +561,7 @@ Test.Modules.SHAPE = {
|
||||
test(circle.getDashArrayEnabled() === true, 'dashArrayEnabled should be true');
|
||||
|
||||
circle.disableFill();
|
||||
|
||||
|
||||
test(circle.getFillEnabled() === false, 'fillEnabled should be false');
|
||||
test(circle.getStrokeEnabled() === true, 'strokeEnabled should be true');
|
||||
test(circle.getShadowEnabled() === true, 'shadowEnabled should be true');
|
||||
|
@@ -256,12 +256,16 @@ Test.Modules.Text = {
|
||||
|
||||
var width = text.getWidth();
|
||||
var height = text.getHeight();
|
||||
|
||||
|
||||
|
||||
layer.add(text);
|
||||
stage.add(layer);
|
||||
|
||||
text.setFontSize(30);
|
||||
layer.draw();
|
||||
|
||||
//console.log(text.getHeight() + ',' + height);
|
||||
|
||||
test(text.getWidth() > width, 'text box width should have increased.');
|
||||
test(text.getHeight() > height, 'text box height should have increased.');
|
||||
|
@@ -67,37 +67,6 @@ Test.Modules.STAGE = {
|
||||
test(layer.getCanvas().element.width === 333, 'layer canvas element width should be 333');
|
||||
test(layer.getCanvas().element.height === 155, 'layer canvas element width should be 155');
|
||||
},
|
||||
'reset stage': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200,
|
||||
x: 100
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
var group = new Kinetic.Group();
|
||||
var circle = new Kinetic.Circle({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
radius: 70,
|
||||
fill: 'green',
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
name: 'myCircle',
|
||||
draggable: true
|
||||
});
|
||||
|
||||
stage.add(layer);
|
||||
layer.add(group);
|
||||
group.add(circle);
|
||||
layer.draw();
|
||||
|
||||
test(stage.getChildren().length === 1, 'stage should have one child');
|
||||
test(stage.getX() === 100, 'stage x should be 100');
|
||||
stage.reset();
|
||||
test(stage.getChildren().length === 0, 'stage should have no children');
|
||||
test(stage.getX() === 0, 'stage x should be 0');
|
||||
},
|
||||
'get stage DOM': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
Reference in New Issue
Block a user