mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Fix IO text labels' fill attr being saved even if default colour (#4083)
* move exporting of fill attr to subclasses * set text colour for new labels
This commit is contained in:
parent
615bbf95a1
commit
5cb191d624
5 changed files with 8 additions and 1 deletions
|
@ -49,7 +49,6 @@ export class Shape {
|
||||||
left: floatToDisplay(this.left),
|
left: floatToDisplay(this.left),
|
||||||
top: floatToDisplay(this.top),
|
top: floatToDisplay(this.top),
|
||||||
...(!angle ? {} : { angle: angle.toString() }),
|
...(!angle ? {} : { angle: angle.toString() }),
|
||||||
...(this.fill === SHAPE_MASK_COLOR ? {} : { fill: this.fill }),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import { fabric } from "fabric";
|
import { fabric } from "fabric";
|
||||||
|
|
||||||
|
import { SHAPE_MASK_COLOR } from "../tools/lib";
|
||||||
import type { ConstructorParams, Size } from "../types";
|
import type { ConstructorParams, Size } from "../types";
|
||||||
import type { ShapeDataForCloze } from "./base";
|
import type { ShapeDataForCloze } from "./base";
|
||||||
import { Shape } from "./base";
|
import { Shape } from "./base";
|
||||||
|
@ -25,6 +26,7 @@ export class Ellipse extends Shape {
|
||||||
...super.toDataForCloze(),
|
...super.toDataForCloze(),
|
||||||
rx: floatToDisplay(this.rx),
|
rx: floatToDisplay(this.rx),
|
||||||
ry: floatToDisplay(this.ry),
|
ry: floatToDisplay(this.ry),
|
||||||
|
...(this.fill === SHAPE_MASK_COLOR ? {} : { fill: this.fill }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import { fabric } from "fabric";
|
import { fabric } from "fabric";
|
||||||
|
|
||||||
|
import { SHAPE_MASK_COLOR } from "../tools/lib";
|
||||||
import type { ConstructorParams, Size } from "../types";
|
import type { ConstructorParams, Size } from "../types";
|
||||||
import type { ShapeDataForCloze } from "./base";
|
import type { ShapeDataForCloze } from "./base";
|
||||||
import { Shape } from "./base";
|
import { Shape } from "./base";
|
||||||
|
@ -22,6 +23,7 @@ export class Polygon extends Shape {
|
||||||
return {
|
return {
|
||||||
...super.toDataForCloze(),
|
...super.toDataForCloze(),
|
||||||
points: this.points.map(({ x, y }) => `${floatToDisplay(x)},${floatToDisplay(y)}`).join(" "),
|
points: this.points.map(({ x, y }) => `${floatToDisplay(x)},${floatToDisplay(y)}`).join(" "),
|
||||||
|
...(this.fill === SHAPE_MASK_COLOR ? {} : { fill: this.fill }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import { fabric } from "fabric";
|
import { fabric } from "fabric";
|
||||||
|
|
||||||
|
import { SHAPE_MASK_COLOR } from "../tools/lib";
|
||||||
import type { ConstructorParams, Size } from "../types";
|
import type { ConstructorParams, Size } from "../types";
|
||||||
import type { ShapeDataForCloze } from "./base";
|
import type { ShapeDataForCloze } from "./base";
|
||||||
import { Shape } from "./base";
|
import { Shape } from "./base";
|
||||||
|
@ -25,6 +26,7 @@ export class Rectangle extends Shape {
|
||||||
...super.toDataForCloze(),
|
...super.toDataForCloze(),
|
||||||
width: floatToDisplay(this.width),
|
width: floatToDisplay(this.width),
|
||||||
height: floatToDisplay(this.height),
|
height: floatToDisplay(this.height),
|
||||||
|
...(this.fill === SHAPE_MASK_COLOR ? {} : { fill: this.fill }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
isPointerInBoundingBox,
|
isPointerInBoundingBox,
|
||||||
stopDraw,
|
stopDraw,
|
||||||
TEXT_BACKGROUND_COLOR,
|
TEXT_BACKGROUND_COLOR,
|
||||||
|
TEXT_COLOR,
|
||||||
TEXT_FONT_FAMILY,
|
TEXT_FONT_FAMILY,
|
||||||
TEXT_PADDING,
|
TEXT_PADDING,
|
||||||
} from "./lib";
|
} from "./lib";
|
||||||
|
@ -41,6 +42,7 @@ export const drawText = (canvas: fabric.Canvas, onActivated: Callback): void =>
|
||||||
selectable: true,
|
selectable: true,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
noScaleCache: false,
|
noScaleCache: false,
|
||||||
|
fill: TEXT_COLOR,
|
||||||
fontFamily: TEXT_FONT_FAMILY,
|
fontFamily: TEXT_FONT_FAMILY,
|
||||||
backgroundColor: TEXT_BACKGROUND_COLOR,
|
backgroundColor: TEXT_BACKGROUND_COLOR,
|
||||||
padding: TEXT_PADDING,
|
padding: TEXT_PADDING,
|
||||||
|
|
Loading…
Reference in a new issue