Skip to content

Commit a01f733

Browse files
SW-1327 Adding a mrb file with quicktext to the working area shows an error (mrbeam#1527)
* SW-1327 Move the creation of the outline path from preview to on update * SW-1327 Add a Todo comment for an identified bug described in SW-1445
1 parent 2adfabf commit a01f733

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

octoprint_mrbeam/static/js/working_area.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,10 +3700,6 @@ $(function () {
37003700
$("#quick_text_dialog_text_input").focus();
37013701
});
37023702
$("#quick_text_dialog").modal({ keyboard: true });
3703-
// hide path during quick text editing. will be rendered on dialog close
3704-
snap.select(
3705-
`#${self.currentQuickTextFile.previewId} .qtOutline`
3706-
).attr({ d: "" });
37073703
self.showTransformHandles(
37083704
self.currentQuickTextFile.previewId,
37093705
false
@@ -3913,13 +3909,23 @@ $(function () {
39133909
bb = curvedText.getBBox();
39143910
}
39153911

3916-
g.select("path").attr({
3917-
// when quicktext outline is disabled, stroke color should be white in order to be ignored
3918-
stroke : isStroked ? strokeColor : "#ffffff",
3919-
// when quicktext filling is disabled, fill color should be white for easier cursor selection
3920-
fill: isFilled ? fill : "#ffffff"
3921-
});
3912+
// update text stroke
3913+
if (isStroked) {
3914+
// create text stroke path if option is enabled and ignore if already added
3915+
g.select(".qtOutlineGroup")?.path().attr({
3916+
class: "qtOutline vector_outline",
3917+
});
3918+
// add selected attributes to stroke path
3919+
g.select("path").attr({
3920+
stroke: strokeColor,
3921+
fill: isFilled ? fill : "#ffffff",
3922+
"fill-opacity": isFilled ? 1 : 0,
3923+
});
3924+
} else {
3925+
g.select("qtOutlineGroup")?.remove();
3926+
}
39223927

3928+
// update text rect (rect is for selection only)
39233929
g.select("rect").attr({
39243930
x: bb.x,
39253931
y: bb.y,
@@ -4114,6 +4120,7 @@ $(function () {
41144120
// self._prepareAndInsertSVG(fragment, previewId, origin, '', {showTransformHandles: false, embedGCode: false}, {_skip: true}, file);
41154121
// replaces all code below.
41164122

4123+
// TODO: Bug: SW-1445
41174124
// path for curved text
41184125
const path = snap
41194126
.path()
@@ -4150,10 +4157,8 @@ $(function () {
41504157
class: "straightText",
41514158
});
41524159

4153-
const textStroke = uc.path().attr({
4154-
class: "qtOutline vector_outline",
4155-
fill: "none",
4156-
stroke: file.strokeColor,
4160+
const textStroke = uc.g().attr({
4161+
class: "qtOutlineGroup",
41574162
});
41584163

41594164
var box = uc.rect(); // will be placed and sized by self._qt_currentQuickTextUpdateText()

0 commit comments

Comments
 (0)