mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
update CHANGELOG with new version
This commit is contained in:
@@ -664,8 +664,6 @@ export class SceneContext extends Context {
|
||||
_fillPattern(shape) {
|
||||
var fillPatternX = shape.getFillPatternX(),
|
||||
fillPatternY = shape.getFillPatternY(),
|
||||
fillPatternScaleX = shape.getFillPatternScaleX(),
|
||||
fillPatternScaleY = shape.getFillPatternScaleY(),
|
||||
fillPatternRotation = Konva.getAngle(shape.getFillPatternRotation()),
|
||||
fillPatternOffsetX = shape.getFillPatternOffsetX(),
|
||||
fillPatternOffsetY = shape.getFillPatternOffsetY();
|
||||
@@ -678,9 +676,6 @@ export class SceneContext extends Context {
|
||||
this.rotate(fillPatternRotation);
|
||||
}
|
||||
|
||||
if (fillPatternScaleX || fillPatternScaleY) {
|
||||
this.scale(fillPatternScaleX, fillPatternScaleY);
|
||||
}
|
||||
if (fillPatternOffsetX || fillPatternOffsetY) {
|
||||
this.translate(-1 * fillPatternOffsetX, -1 * fillPatternOffsetY);
|
||||
}
|
||||
|
20
src/Shape.ts
20
src/Shape.ts
@@ -81,7 +81,7 @@ var linearGradient = 'linearGradient';
|
||||
var radialGradient = 'radialGradient';
|
||||
|
||||
var dummyContext;
|
||||
function getDummyContext() {
|
||||
function getDummyContext(): CanvasRenderingContext2D {
|
||||
if (dummyContext) {
|
||||
return dummyContext;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
|
||||
);
|
||||
|
||||
this.on(
|
||||
'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva',
|
||||
'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva',
|
||||
_clearFillPatternCache
|
||||
);
|
||||
|
||||
@@ -261,10 +261,20 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
|
||||
__getFillPattern() {
|
||||
if (this.fillPatternImage()) {
|
||||
var ctx = getDummyContext();
|
||||
return ctx.createPattern(
|
||||
const pattern = ctx.createPattern(
|
||||
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
|
||||
return pattern;
|
||||
}
|
||||
}
|
||||
_getLinearGradient() {
|
||||
@@ -281,7 +291,7 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
|
||||
|
||||
// build color stops
|
||||
for (var n = 0; n < colorStops.length; n += 2) {
|
||||
grd.addColorStop(colorStops[n], colorStops[n + 1]);
|
||||
grd.addColorStop(colorStops[n] as number, colorStops[n + 1] as string);
|
||||
}
|
||||
return grd;
|
||||
}
|
||||
@@ -308,7 +318,7 @@ export class Shape<Config extends ShapeConfig = ShapeConfig> extends Node<
|
||||
|
||||
// build color stops
|
||||
for (var n = 0; n < colorStops.length; n += 2) {
|
||||
grd.addColorStop(colorStops[n], colorStops[n + 1]);
|
||||
grd.addColorStop(colorStops[n] as number, colorStops[n + 1] as string);
|
||||
}
|
||||
return grd;
|
||||
}
|
||||
|
Reference in New Issue
Block a user