mirror of
https://github.com/konvajs/konva.git
synced 2026-01-22 21:02:26 +08:00
Merge remote-tracking branch 'upstream/master' into change-text-paths
This commit is contained in:
@@ -1750,7 +1750,7 @@ describe('MouseEvents', function () {
|
||||
assert.equal(shape, circle);
|
||||
});
|
||||
|
||||
it('double click after click should trigger event', function (done) {
|
||||
it('double click after click should trigger event', function () {
|
||||
var stage = addStage();
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
@@ -1802,37 +1802,31 @@ describe('MouseEvents', function () {
|
||||
assert.equal(smallClicks, 0, 'no click on small rect');
|
||||
assert.equal(smallDblClicks, 0, 'no dblclick on small rect');
|
||||
|
||||
setTimeout(function () {
|
||||
simulateMouseDown(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
simulateMouseUp(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
|
||||
assert.equal(bigClicks, 1, 'single click on big rect');
|
||||
assert.equal(smallClicks, 1, 'single click on small rect');
|
||||
assert.equal(smallDblClicks, 0, 'no dblclick on small rect');
|
||||
|
||||
setTimeout(function () {
|
||||
simulateMouseDown(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
simulateMouseUp(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
|
||||
assert.equal(bigClicks, 1, 'single click on big rect');
|
||||
assert.equal(smallClicks, 2, 'second click on small rect');
|
||||
assert.equal(smallDblClicks, 1, 'single dblclick on small rect');
|
||||
|
||||
done();
|
||||
});
|
||||
simulateMouseDown(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
simulateMouseUp(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
|
||||
assert.equal(bigClicks, 1, 'single click on big rect');
|
||||
assert.equal(smallClicks, 1, 'single click on small rect');
|
||||
assert.equal(smallDblClicks, 0, 'no dblclick on small rect');
|
||||
|
||||
simulateMouseDown(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
simulateMouseUp(stage, {
|
||||
x: 100,
|
||||
y: 100,
|
||||
});
|
||||
|
||||
assert.equal(bigClicks, 1, 'single click on big rect');
|
||||
assert.equal(smallClicks, 2, 'second click on small rect');
|
||||
assert.equal(smallDblClicks, 1, 'single dblclick on small rect');
|
||||
});
|
||||
|
||||
it('click on stage and second click on shape should not trigger double click (check after dblclick)', function (done) {
|
||||
|
||||
@@ -667,15 +667,12 @@ describe('Text', function () {
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
let trace =
|
||||
'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);font=normal normal 30px Arial;textBaseline=middle;textAlign=left;translate(0,0);save();fillStyle=black;fillText(Y,0,15);fillStyle=black;fillText(O,20,15);fillStyle=black;fillText(U,43,15);fillStyle=black;fillText( ,65,15);fillStyle=black;fillText(A,73,15);fillStyle=black;fillText(R,93,15);fillStyle=black;fillText(E,115,15);fillStyle=black;fillText( ,135,15);fillStyle=black;fillText(I,143,15);fillStyle=black;fillText(N,151,15);fillStyle=black;fillText(V,173,15);fillStyle=black;fillText(I,193,15);fillStyle=black;fillText(T,201,15);fillStyle=black;fillText(E,220,15);fillStyle=black;fillText(D,240,15);fillStyle=black;fillText(!,261,15);restore();restore();';
|
||||
if (Konva.isBrowser) {
|
||||
var trace =
|
||||
'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);font=normal normal 30px Arial;textBaseline=middle;textAlign=left;translate(0,0);save();fillStyle=black;fillText(Y,0,15);fillStyle=black;fillText(O,20,15);fillStyle=black;fillText(U,43,15);fillStyle=black;fillText( ,65,15);fillStyle=black;fillText(A,73,15);fillStyle=black;fillText(R,93,15);fillStyle=black;fillText(E,115,15);fillStyle=black;fillText( ,135,15);fillStyle=black;fillText(I,143,15);fillStyle=black;fillText(N,151,15);fillStyle=black;fillText(V,173,15);fillStyle=black;fillText(I,193,15);fillStyle=black;fillText(T,201,15);fillStyle=black;fillText(E,220,15);fillStyle=black;fillText(D,240,15);fillStyle=black;fillText(!,261,15);restore();restore();';
|
||||
|
||||
if (!isBrowser) {
|
||||
trace =
|
||||
'clearRect(0,0,578,200);save();transform(1,0,0,1,10,10);font=normal normal 30px Arial;textBaseline=middle;textAlign=left;translate(0,0);save();fillStyle=black;fillText(Y,0,15);fillStyle=black;fillText(O,20,15);fillStyle=black;fillText(U,43,15);fillStyle=black;fillText( ,65,15);fillStyle=black;fillText(A,73,15);fillStyle=black;fillText(R,93,15);fillStyle=black;fillText(E,115,15);fillStyle=black;fillText( ,135,15);fillStyle=black;fillText(I,143,15);fillStyle=black;fillText(N,151,15);fillStyle=black;fillText(V,173,15);fillStyle=black;fillText(I,193,15);fillStyle=black;fillText(T,201,15);fillStyle=black;fillText(E,219,15);fillStyle=black;fillText(D,239,15);fillStyle=black;fillText(!,261,15);restore();restore();';
|
||||
assert.equal(layer.getContext().getTrace(false, true), trace);
|
||||
}
|
||||
|
||||
assert.equal(layer.getContext().getTrace(false, true), trace);
|
||||
});
|
||||
|
||||
it('text multi line with justify align and several paragraphs', function () {
|
||||
|
||||
@@ -4769,4 +4769,17 @@ describe('Transformer', function () {
|
||||
assert.equal(clone.getChildren().length, tr.getChildren().length);
|
||||
assert.equal(clone.nodes().length, 0);
|
||||
});
|
||||
|
||||
it('should filter parent of the transformer', function () {
|
||||
const stage = addStage();
|
||||
|
||||
const layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
const tr = new Konva.Transformer();
|
||||
layer.add(tr);
|
||||
|
||||
tr.nodes([layer]);
|
||||
assert.equal(tr.nodes().length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user