Merge pull request #1763 from gavin-ts/fix-sketched-unfilled-triangle
Fix sketched unfilled triangle
This commit is contained in:
commit
8d516665e9
4 changed files with 145 additions and 2 deletions
|
|
@ -5,3 +5,4 @@
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
- Fix importing files that override an existing value with an array. [#1762](https://github.com/terrastruct/d2/pull/1762)
|
- Fix importing files that override an existing value with an array. [#1762](https://github.com/terrastruct/d2/pull/1762)
|
||||||
|
- Fixed missing unfilled triangle arrowheads when sketch flag is on. [#1763](https://github.com/terrastruct/d2/pull/1763)
|
||||||
|
|
|
||||||
|
|
@ -733,6 +733,14 @@ func ArrowheadJS(r *Runner, arrowhead d2target.Arrowhead, stroke string, strokeW
|
||||||
stroke,
|
stroke,
|
||||||
stroke,
|
stroke,
|
||||||
)
|
)
|
||||||
|
case d2target.UnfilledTriangleArrowhead:
|
||||||
|
arrowJS = fmt.Sprintf(
|
||||||
|
`node = rc.polygon(%s, { strokeWidth: %d, stroke: "%s", fill: "%s", fillStyle: "solid", seed: 2 })`,
|
||||||
|
`[[-10, -4], [0, 0], [-10, 4]]`,
|
||||||
|
strokeWidth,
|
||||||
|
stroke,
|
||||||
|
BG_COLOR,
|
||||||
|
)
|
||||||
case d2target.DiamondArrowhead:
|
case d2target.DiamondArrowhead:
|
||||||
arrowJS = fmt.Sprintf(
|
arrowJS = fmt.Sprintf(
|
||||||
`node = rc.polygon(%s, { strokeWidth: %d, stroke: "%s", fill: "%s", fillStyle: "solid", seed: 1 })`,
|
`node = rc.polygon(%s, { strokeWidth: %d, stroke: "%s", fill: "%s", fillStyle: "solid", seed: 1 })`,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package d2sketch_test
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -1304,6 +1303,26 @@ a -> b: {
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "unfilled_triangle",
|
||||||
|
script: `
|
||||||
|
direction: right
|
||||||
|
|
||||||
|
A <-> B: default {
|
||||||
|
source-arrowhead.style.filled: false
|
||||||
|
target-arrowhead.style.filled: false
|
||||||
|
}
|
||||||
|
C <-> D: triangle {
|
||||||
|
source-arrowhead: {
|
||||||
|
shape: triangle
|
||||||
|
style.filled: false
|
||||||
|
}
|
||||||
|
target-arrowhead: {
|
||||||
|
shape: triangle
|
||||||
|
style.filled: false
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
runa(t, tcs)
|
runa(t, tcs)
|
||||||
}
|
}
|
||||||
|
|
@ -1367,7 +1386,7 @@ func run(t *testing.T, tc testCase) {
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
err = os.MkdirAll(dataPath, 0755)
|
err = os.MkdirAll(dataPath, 0755)
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
err = ioutil.WriteFile(pathGotSVG, svgBytes, 0600)
|
err = os.WriteFile(pathGotSVG, svgBytes, 0600)
|
||||||
assert.Success(t, err)
|
assert.Success(t, err)
|
||||||
defer os.Remove(pathGotSVG)
|
defer os.Remove(pathGotSVG)
|
||||||
|
|
||||||
|
|
|
||||||
115
d2renderers/d2sketch/testdata/unfilled_triangle/sketch.exp.svg
vendored
Normal file
115
d2renderers/d2sketch/testdata/unfilled_triangle/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 70 KiB |
Loading…
Reference in a new issue