mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Fix Konva.Transformer
behavior on scaled with CSS stage. fix #841.
This commit is contained in:
@@ -1049,7 +1049,8 @@ suite('Shape', function() {
|
||||
width: 100,
|
||||
height: 50,
|
||||
stroke: 'red',
|
||||
strokeWidth: 20
|
||||
strokeWidth: 20,
|
||||
draggable: true
|
||||
});
|
||||
// default value
|
||||
assert.equal(rect.strokeHitEnabled(), true);
|
||||
@@ -1122,7 +1123,6 @@ suite('Shape', function() {
|
||||
// );
|
||||
});
|
||||
|
||||
|
||||
test('enable hitStrokeWidth even if we have no stroke on scene', function() {
|
||||
var stage = addStage();
|
||||
|
||||
@@ -1918,4 +1918,51 @@ suite('Shape', function() {
|
||||
assert.equal(callCount, 1);
|
||||
Konva.Util.warn = oldWarn;
|
||||
});
|
||||
|
||||
test('hasFill getter', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var shape = new Konva.Shape({
|
||||
stroke: 'black',
|
||||
strokeWidth: 4,
|
||||
sceneFunc: function(context) {
|
||||
context.beginPath();
|
||||
context.moveTo(20, 50);
|
||||
context.quadraticCurveTo(550, 0, 500, 500);
|
||||
context.fillStrokeShape(shape);
|
||||
},
|
||||
fill: 'red',
|
||||
fillEnabled: false
|
||||
});
|
||||
|
||||
layer.add(shape);
|
||||
assert.equal(shape.hasFill(), false);
|
||||
});
|
||||
|
||||
test('test hit of non filled shape', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var line = new Konva.Shape({
|
||||
sceneFunc: function(context) {
|
||||
context.beginPath();
|
||||
context.moveTo(20, 50);
|
||||
context.quadraticCurveTo(550, 0, 500, 500);
|
||||
|
||||
context.fillStrokeShape(line);
|
||||
}
|
||||
});
|
||||
|
||||
layer.add(line);
|
||||
layer.draw();
|
||||
|
||||
// we still should register shape here
|
||||
// like for a non filled rectangle (with just stroke),
|
||||
// we need fill it for full events
|
||||
var shape = layer.getIntersection({ x: 50, y: 70 });
|
||||
assert.equal(shape, line);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user