mirror of
https://github.com/konvajs/konva.git
synced 2025-09-23 04:36:47 +08:00
fix fill patter scale for text. close #720
This commit is contained in:
22
konva.js
22
konva.js
@@ -2152,9 +2152,6 @@
|
||||
if (fillPatternRotation) {
|
||||
this.rotate(fillPatternRotation);
|
||||
}
|
||||
if (fillPatternScaleX || fillPatternScaleY) {
|
||||
this.scale(fillPatternScaleX, fillPatternScaleY);
|
||||
}
|
||||
if (fillPatternOffsetX || fillPatternOffsetY) {
|
||||
this.translate(-1 * fillPatternOffsetX, -1 * fillPatternOffsetY);
|
||||
}
|
||||
@@ -7003,15 +7000,16 @@
|
||||
if (this.fillPatternImage()) {
|
||||
var ctx = getDummyContext();
|
||||
var pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');
|
||||
// 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).
|
||||
// });
|
||||
if (pattern && pattern.setTransform) {
|
||||
pattern.setTransform({
|
||||
a: this.fillPatternScaleX(),
|
||||
b: 0,
|
||||
c: 0,
|
||||
d: this.fillPatternScaleY(),
|
||||
e: 0,
|
||||
f: 0,
|
||||
});
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
};
|
||||
|
2
konva.min.js
vendored
2
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -676,7 +676,7 @@ export class SceneContext extends Context {
|
||||
}
|
||||
|
||||
if (fillPatternScaleX || fillPatternScaleY) {
|
||||
this.scale(fillPatternScaleX, fillPatternScaleY);
|
||||
// this.scale(fillPatternScaleX, fillPatternScaleY);
|
||||
}
|
||||
|
||||
if (fillPatternOffsetX || fillPatternOffsetY) {
|
||||
|
19
src/Shape.ts
19
src/Shape.ts
@@ -242,15 +242,16 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
|
||||
this.fillPatternImage(),
|
||||
this.fillPatternRepeat() || 'repeat'
|
||||
);
|
||||
// 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).
|
||||
// });
|
||||
if (pattern && pattern.setTransform) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
suite.only('Stage', function () {
|
||||
suite('Stage', function () {
|
||||
// ======================================================
|
||||
test('instantiate stage with id', function () {
|
||||
var container = Konva.document.createElement('div');
|
||||
|
@@ -1183,7 +1183,7 @@ suite('Text', function () {
|
||||
imageObj.src = 'assets/darth-vader.jpg';
|
||||
});
|
||||
|
||||
test.skip('image gradient for text with scale', function (done) {
|
||||
test('image gradient for text with scale', function (done) {
|
||||
Konva.pixelRatio = 1;
|
||||
var imageObj = new Image();
|
||||
imageObj.onload = function () {
|
||||
|
Reference in New Issue
Block a user