mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -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": {
|
||||
"indentWidth": 4
|
||||
"indentWidth": 4,
|
||||
"useBraces": "always"
|
||||
},
|
||||
"json": {
|
||||
"indentWidth": 4
|
||||
|
|
|
@ -152,7 +152,10 @@ function drawShape({
|
|||
ctx.lineWidth = strokeWidth;
|
||||
if (shape instanceof Rectangle) {
|
||||
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) {
|
||||
const adjustedLeft = shape.left + shape.rx;
|
||||
const adjustedTop = shape.top + shape.ry;
|
||||
|
@ -169,7 +172,9 @@ function drawShape({
|
|||
);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
if (strokeWidth) {
|
||||
ctx.stroke();
|
||||
}
|
||||
} else if (shape instanceof Polygon) {
|
||||
const offset = getPolygonOffset(shape);
|
||||
ctx.save();
|
||||
|
@ -181,7 +186,9 @@ function drawShape({
|
|||
}
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
if (strokeWidth) {
|
||||
ctx.stroke();
|
||||
}
|
||||
ctx.restore();
|
||||
} else if (shape instanceof Text) {
|
||||
ctx.save();
|
||||
|
@ -267,13 +274,13 @@ function getShapeProperties(): ShapeProperties {
|
|||
? inActiveShapeColor
|
||||
: "#ffeba2",
|
||||
activeBorder: {
|
||||
width: activeShapeBorderWidth ? activeShapeBorderWidth : 1,
|
||||
width: !isNaN(activeShapeBorderWidth) ? activeShapeBorderWidth : 1,
|
||||
color: activeShapeBorderColor
|
||||
? activeShapeBorderColor
|
||||
: "#212121",
|
||||
},
|
||||
inActiveBorder: {
|
||||
width: inActiveShapeBorderWidth ? inActiveShapeBorderWidth : 1,
|
||||
width: !isNaN(inActiveShapeBorderWidth) ? inActiveShapeBorderWidth : 1,
|
||||
color: inActiveShapeBorderColor
|
||||
? inActiveShapeBorderColor
|
||||
: "#212121",
|
||||
|
|
Loading…
Reference in a new issue