mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
fill masks in editor
This commit is contained in:
parent
3b056c98d6
commit
1a907af5d0
3 changed files with 5 additions and 2 deletions
|
|
@ -77,6 +77,7 @@ function extractShapeFromRenderedCloze(cloze: HTMLDivElement): Shape | null {
|
|||
scale: cloze.dataset.scale,
|
||||
fs: cloze.dataset.fontSize,
|
||||
angle: cloze.dataset.angle,
|
||||
...(cloze.dataset.fill == null ? {} : { fill: cloze.dataset.fill }),
|
||||
};
|
||||
return buildShape(type, props);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ export class Text extends Shape {
|
|||
text = "",
|
||||
scaleX = 1,
|
||||
scaleY = 1,
|
||||
fill = TEXT_COLOR,
|
||||
fontSize,
|
||||
...rest
|
||||
}: ConstructorParams<Text> = {}) {
|
||||
super(rest);
|
||||
this.fill = TEXT_COLOR;
|
||||
this.fill = fill;
|
||||
this.text = text;
|
||||
this.scaleX = scaleX;
|
||||
this.scaleY = scaleY;
|
||||
|
|
@ -38,6 +39,7 @@ export class Text extends Shape {
|
|||
// scaleX and scaleY are guaranteed to be equal since we lock the aspect ratio
|
||||
scale: floatToDisplay(this.scaleX),
|
||||
fs: this.fontSize ? floatToDisplay(this.fontSize) : undefined,
|
||||
...(this.fill === TEXT_COLOR ? {} : { fill: this.fill }),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export const modifiedPolygon = (canvas: fabric.Canvas, polygon: fabric.Polygon):
|
|||
});
|
||||
|
||||
const polygon1 = new fabric.Polygon(transformedPoints, {
|
||||
fill: SHAPE_MASK_COLOR,
|
||||
fill: polygon.fill ?? SHAPE_MASK_COLOR,
|
||||
objectCaching: false,
|
||||
stroke: BORDER_COLOR,
|
||||
strokeWidth: 1,
|
||||
|
|
|
|||
Loading…
Reference in a new issue