fix dragend bug, revert back text fill pattern fix

This commit is contained in:
Anton Lavrenov
2019-09-05 13:01:20 -05:00
parent 89e332229b
commit 2988dce492
7 changed files with 87 additions and 27 deletions

View File

@@ -666,7 +666,9 @@ export class SceneContext extends Context {
fillPatternY = shape.getFillPatternY(),
fillPatternRotation = Konva.getAngle(shape.getFillPatternRotation()),
fillPatternOffsetX = shape.getFillPatternOffsetX(),
fillPatternOffsetY = shape.getFillPatternOffsetY();
fillPatternOffsetY = shape.getFillPatternOffsetY(),
fillPatternScaleX = shape.getFillPatternScaleX(),
fillPatternScaleY = shape.getFillPatternScaleY();
if (fillPatternX || fillPatternY) {
this.translate(fillPatternX || 0, fillPatternY || 0);
@@ -676,6 +678,10 @@ export class SceneContext extends Context {
this.rotate(fillPatternRotation);
}
if (fillPatternScaleX || fillPatternScaleY) {
this.scale(fillPatternScaleX, fillPatternScaleY);
}
if (fillPatternOffsetX || fillPatternOffsetY) {
this.translate(-1 * fillPatternOffsetX, -1 * fillPatternOffsetY);
}

View File

@@ -110,10 +110,9 @@ export const DD = {
if (elem.dragStatus === 'dragging') {
DD.justDragged = true;
Konva.listenClickTap = false;
elem.dragStatus = 'stopped';
}
elem.dragStatus = 'stopped';
const drawNode =
elem.node.getLayer() ||
(elem.node instanceof Konva['Stage'] && elem.node);
@@ -134,6 +133,8 @@ export const DD = {
},
true
);
}
if (elem.dragStatus !== 'dragging') {
DD._dragElements.delete(key);
}
});

View File

@@ -265,15 +265,15 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
this.fillPatternImage(),
this.fillPatternRepeat() || 'repeat'
);
pattern.setTransform({
a: this.fillPatternScaleX(), // Horizontal scaling. A value of 1 results in no scaling.
b: 0, // Vertical skewing.
c: 0, // Horizontal skewing.
d: this.fillPatternScaleY(), // Vertical scaling. A value of 1 results in no scaling.
e: 0, // Horizontal translation (moving).
f: 0 // Vertical translation (moving).
});
// pattern.setTransform
// TODO: how to enable it? It doesn't work in FF...
// pattern.setTransform({
// a: this.fillPatternScaleX(), // Horizontal scaling. A value of 1 results in no scaling.
// b: 0, // Vertical skewing.
// c: 0, // Horizontal skewing.
// d: this.fillPatternScaleY(), // Vertical scaling. A value of 1 results in no scaling.
// e: 0, // Horizontal translation (moving).
// f: 0 // Vertical translation (moving).
// });
return pattern;
}
}