mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
Allow disabling occlusion mask border (#2764)
* Allow setting occlusion mask border to zero
* Switch to multi-line if statements
cf. 9740393d72
* Enforce if statement braces in dprint
---------
Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
This commit is contained in:
parent
14940a617b
commit
8e828f2955
2 changed files with 14 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"indentWidth": 4
|
"indentWidth": 4,
|
||||||
|
"useBraces": "always"
|
||||||
},
|
},
|
||||||
"json": {
|
"json": {
|
||||||
"indentWidth": 4
|
"indentWidth": 4
|
||||||
|
|
|
@ -152,7 +152,10 @@ function drawShape({
|
||||||
ctx.lineWidth = strokeWidth;
|
ctx.lineWidth = strokeWidth;
|
||||||
if (shape instanceof Rectangle) {
|
if (shape instanceof Rectangle) {
|
||||||
ctx.fillRect(shape.left, shape.top, shape.width, shape.height);
|
ctx.fillRect(shape.left, shape.top, shape.width, shape.height);
|
||||||
ctx.strokeRect(shape.left, shape.top, shape.width, shape.height);
|
// ctx stroke methods will draw a visible stroke, even if the width is 0
|
||||||
|
if (strokeWidth) {
|
||||||
|
ctx.strokeRect(shape.left, shape.top, shape.width, shape.height);
|
||||||
|
}
|
||||||
} else if (shape instanceof Ellipse) {
|
} else if (shape instanceof Ellipse) {
|
||||||
const adjustedLeft = shape.left + shape.rx;
|
const adjustedLeft = shape.left + shape.rx;
|
||||||
const adjustedTop = shape.top + shape.ry;
|
const adjustedTop = shape.top + shape.ry;
|
||||||
|
@ -169,7 +172,9 @@ function drawShape({
|
||||||
);
|
);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.stroke();
|
if (strokeWidth) {
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
} else if (shape instanceof Polygon) {
|
} else if (shape instanceof Polygon) {
|
||||||
const offset = getPolygonOffset(shape);
|
const offset = getPolygonOffset(shape);
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
@ -181,7 +186,9 @@ function drawShape({
|
||||||
}
|
}
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
ctx.stroke();
|
if (strokeWidth) {
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
} else if (shape instanceof Text) {
|
} else if (shape instanceof Text) {
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
@ -267,13 +274,13 @@ function getShapeProperties(): ShapeProperties {
|
||||||
? inActiveShapeColor
|
? inActiveShapeColor
|
||||||
: "#ffeba2",
|
: "#ffeba2",
|
||||||
activeBorder: {
|
activeBorder: {
|
||||||
width: activeShapeBorderWidth ? activeShapeBorderWidth : 1,
|
width: !isNaN(activeShapeBorderWidth) ? activeShapeBorderWidth : 1,
|
||||||
color: activeShapeBorderColor
|
color: activeShapeBorderColor
|
||||||
? activeShapeBorderColor
|
? activeShapeBorderColor
|
||||||
: "#212121",
|
: "#212121",
|
||||||
},
|
},
|
||||||
inActiveBorder: {
|
inActiveBorder: {
|
||||||
width: inActiveShapeBorderWidth ? inActiveShapeBorderWidth : 1,
|
width: !isNaN(inActiveShapeBorderWidth) ? inActiveShapeBorderWidth : 1,
|
||||||
color: inActiveShapeBorderColor
|
color: inActiveShapeBorderColor
|
||||||
? inActiveShapeBorderColor
|
? inActiveShapeBorderColor
|
||||||
: "#212121",
|
: "#212121",
|
||||||
|
|
Loading…
Reference in a new issue