Skip to content

Commit

Permalink
Fix text render on canvas copy SVG/PNG (#157)
Browse files Browse the repository at this point in the history
* add fill, remove stroke

* 1.10.16
  • Loading branch information
mdroidian authored Sep 23, 2023
1 parent 1df786d commit 2a90d1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-builder",
"version": "1.10.15",
"version": "1.10.16",
"description": "Introduces new user interfaces for building queries in Roam",
"main": "./build/main.js",
"author": {
Expand Down
9 changes: 6 additions & 3 deletions src/components/TldrawCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,10 @@ class DiscourseNodeUtil extends TLBoxUtil<DiscourseNodeShape> {
rect.setAttribute("ry", "16");
g.appendChild(rect);

// TODO: Look at ./node_modules/@tldraw/tldraw/node_modules/@tldraw/editor/dist/cjs/lib/app/shapeutils/TLTextUtil/TLTextUtil.js toSvg method
// TODO: Look at Look at TLTextUtil / TLGeoUtil toSvg methods
// ./node_modules/@tldraw/tldraw/node_modules/@tldraw/editor/dist/cjs/lib/app/shapeutils/
// /TLTextUtil/TLTextUtil.js
// /TLGeoUtil/TLGeoUtil.js
// for non-manual way to implement this
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
const padding = Number(DEFAULT_STYLE_PROPS.padding.replace("px", ""));
Expand All @@ -787,8 +790,8 @@ class DiscourseNodeUtil extends TLBoxUtil<DiscourseNodeShape> {
text.setAttribute("font-family", "sans-serif");
text.setAttribute("font-size", DEFAULT_STYLE_PROPS.fontSize + "px");
text.setAttribute("font-weight", DEFAULT_STYLE_PROPS.fontWeight);
text.setAttribute("stroke", textColor);
text.setAttribute("stroke-width", "1");
text.setAttribute("fill", textColor);
text.setAttribute("stroke", "none");
const words = shape.props.title.split(/\s/g);
let line = "";
let lineCount = 0;
Expand Down

0 comments on commit 2a90d1e

Please sign in to comment.