Skip to content

Commit

Permalink
Add empty stroke style (remove path)
Browse files Browse the repository at this point in the history
  • Loading branch information
crocsg committed Nov 4, 2024
1 parent d5186aa commit 74667d5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
12 changes: 12 additions & 0 deletions src/braillegeometry/DashIterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ class DashIterator
return 0;
}

isempty ()
{
if (! this.dash)
return true;
if (this.dash.length < 1)
return true;
if (this.dash[0].length < 2)
return true;
if (this.dash[0][0] == 0 && this.dash[0][1] == 0)
return true;
return false;
}
next ()
{
let ret = this.step;
Expand Down
6 changes: 2 additions & 4 deletions src/braillegeometry/PageBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,23 +494,21 @@ class PageBuilder
{
console.log (item);
let path = item;
let defdash = [[8,0]]; // default dash style
let defdash = [[8,0]]; // default dash style to full

// select dash style if any
if (path.strokeColor)
{
let sid = dashstrategy.getPatternId (path.strokeColor);
if (sid >= 0 && sid < dashlist.length)
{
console.log (dashlist);
console.log (dashlist[sid])
defdash = dashlist[sid].dash;
}
}
let dashit = new DashIterator (defdash, this.params.stepvectormm);

// item is path => build dots positions along all vectors
if (path.segments != null) {
if (path.segments != null && ! dashit.isempty()) {

for (let i = dashit.reset(); i < path.length; i += dashit.next()) {
let dot = path.getPointAt(i);
Expand Down
7 changes: 1 addition & 6 deletions src/pages/Patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,13 @@ class Patterns extends React.Component {

<select
onChange={(event) => this.onStrokeStyleChange(event, strokecolor.color)}

value={selected}

>
<option value={-1}>{this.context.GetLocaleString("pattern.selectempy")}</option>
<option value={-1}>{this.context.GetLocaleString("pattern.selectfull")}</option>
{ dashstroke.map((dash, index) =>
{

return (
<option value={index} >


{dash.description}
</option>);
} )}
Expand Down
9 changes: 8 additions & 1 deletion src/patterns/linestroke.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,12 @@
[1,1],
[1,1]
]
}
},
{
"description":"0/0",
"dash":[
[0,0]

]
}
]

0 comments on commit 74667d5

Please sign in to comment.