change paintbucket gap filling
This commit is contained in:
parent
50e1844caa
commit
a7b4ea8789
21
src/main.js
21
src/main.js
|
|
@ -32,7 +32,7 @@ forwardConsole('warn', warn);
|
||||||
forwardConsole('error', error);
|
forwardConsole('error', error);
|
||||||
|
|
||||||
// Debug flags
|
// Debug flags
|
||||||
const debugQuadtree =false
|
const debugQuadtree = false
|
||||||
const debugPaintbucket = false
|
const debugPaintbucket = false
|
||||||
|
|
||||||
const macOS = navigator.userAgent.includes('Macintosh')
|
const macOS = navigator.userAgent.includes('Macintosh')
|
||||||
|
|
@ -112,7 +112,13 @@ let tools = {
|
||||||
},
|
},
|
||||||
paint_bucket: {
|
paint_bucket: {
|
||||||
icon: "/assets/paint_bucket.svg",
|
icon: "/assets/paint_bucket.svg",
|
||||||
properties: {}
|
properties: {
|
||||||
|
"fillGaps": {
|
||||||
|
type: "number",
|
||||||
|
label: "Fill Gaps",
|
||||||
|
min: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,6 +141,7 @@ let context = {
|
||||||
simplifyMode: "smooth",
|
simplifyMode: "smooth",
|
||||||
fillShape: true,
|
fillShape: true,
|
||||||
strokeShape: true,
|
strokeShape: true,
|
||||||
|
fillGaps: 5,
|
||||||
dragging: false,
|
dragging: false,
|
||||||
selectionRect: undefined,
|
selectionRect: undefined,
|
||||||
selection: [],
|
selection: [],
|
||||||
|
|
@ -2730,7 +2737,7 @@ function stage() {
|
||||||
let line = {p1: mouse, p2: {x: mouse.x + 3000, y: mouse.y}}
|
let line = {p1: mouse, p2: {x: mouse.x + 3000, y: mouse.y}}
|
||||||
debugCurves = []
|
debugCurves = []
|
||||||
debugPoints = []
|
debugPoints = []
|
||||||
let epsilon = 5;
|
let epsilon = context.fillGaps;
|
||||||
let min_x = Infinity;
|
let min_x = Infinity;
|
||||||
let curveB = undefined
|
let curveB = undefined
|
||||||
let point = undefined
|
let point = undefined
|
||||||
|
|
@ -3548,6 +3555,12 @@ function updateInfopanel() {
|
||||||
input.className = "infopanel-input"
|
input.className = "infopanel-input"
|
||||||
input.type = "number"
|
input.type = "number"
|
||||||
input.value = getProperty(context, property)
|
input.value = getProperty(context, property)
|
||||||
|
if (prop.min) {
|
||||||
|
input.min = prop.min
|
||||||
|
}
|
||||||
|
if (prop.max) {
|
||||||
|
input.max = prop.max
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "enum":
|
case "enum":
|
||||||
input = document.createElement("select")
|
input = document.createElement("select")
|
||||||
|
|
@ -3572,7 +3585,7 @@ function updateInfopanel() {
|
||||||
switch (prop.type) {
|
switch (prop.type) {
|
||||||
case "number":
|
case "number":
|
||||||
if (!isNaN(e.target.value) && e.target.value > 0) {
|
if (!isNaN(e.target.value) && e.target.value > 0) {
|
||||||
setProperty(context, property, e.target.value)
|
setProperty(context, property, parseInt(e.target.value))
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "enum":
|
case "enum":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue