plotboilerplate 1.23.0 → 1.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +19 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +19 -4
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +3 -1
- package/src/cjs/PlotBoilerplate.d.ts +16 -3
- package/src/cjs/PlotBoilerplate.js +19 -4
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/interfaces/externals.d.ts +12 -0
- package/src/cjs/utils/InitializationObserver.d.ts +18 -0
- package/src/cjs/utils/InitializationObserver.js +56 -0
- package/src/cjs/utils/InitializationObserver.js.map +1 -0
- package/src/cjs/utils/creategui.js +319 -251
- package/src/cjs/utils/dat.gui.arrowbounce.polyfill.js +74 -73
- package/src/cjs/utils/dat.gui.title.polyfill.js +9 -7
- package/src/cjs/utils/dom/guiSizeToggler.d.ts +17 -0
- package/src/cjs/utils/dom/guiSizeToggler.js +42 -0
- package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
- package/src/cjs/utils/lil.gui.title.polyfill.js +32 -0
- package/src/esm/PlotBoilerplate.d.ts +16 -3
- package/src/esm/PlotBoilerplate.js +19 -4
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/interfaces/externals.d.ts +12 -0
- package/src/esm/utils/InitializationObserver.d.ts +18 -0
- package/src/esm/utils/InitializationObserver.js +50 -0
- package/src/esm/utils/InitializationObserver.js.map +1 -0
- package/src/esm/utils/dom/guiSizeToggler.d.ts +17 -0
- package/src/esm/utils/dom/guiSizeToggler.js +38 -0
- package/src/esm/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/ts/PlotBoilerplate.ts +38 -10
- package/src/ts/interfaces/externals.ts +16 -0
- package/src/ts/utils/InitializationObserver.ts +63 -0
- package/src/ts/utils/dom/guiSizeToggler.ts +45 -0
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @date 2020-03-30
|
|
9
9
|
* @modified 2020-04-03 Added empty default global object 'utils'. Added createGUI as an optional child.
|
|
10
10
|
* @modified 2023-09-29 Added try-catch for color attributes; invalid values might break construction of whole gui.
|
|
11
|
-
* @
|
|
11
|
+
* @modified 2024-06-25 Replacing dat.gui by equivalent lil-gui calls. Collapsing all lil-gui folders (are open by default).
|
|
12
|
+
* @version 1.1.0
|
|
12
13
|
**/
|
|
13
14
|
var utils = (globalThis.utils = globalThis.utils || {});
|
|
14
15
|
|
|
@@ -31,268 +32,335 @@ globalThis.utils.guiFolders = globalThis.utils.guiFolders || {};
|
|
|
31
32
|
* @method createGUI
|
|
32
33
|
* @memberof utils
|
|
33
34
|
* @param {PlotBoilerplate} pb
|
|
34
|
-
* @param {DatGuiProps} props
|
|
35
|
-
* @return {dat.gui.GUI}
|
|
35
|
+
* @param {DatGuiProps|LilGuiProps} props
|
|
36
|
+
* @return {dat.gui.GUI|lil-gui.GUI|null}
|
|
36
37
|
**/
|
|
37
|
-
globalThis.utils.createGUI = function (
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
globalThis.utils.createGUI = (function () {
|
|
39
|
+
var _tryGetGUIInstance = function (props) {
|
|
40
|
+
if (
|
|
41
|
+
globalThis.hasOwnProperty("lil") &&
|
|
42
|
+
typeof globalThis["lil"] == "object" &&
|
|
43
|
+
globalThis["lil"].hasOwnProperty("GUI") &&
|
|
44
|
+
typeof globalThis["lil"]["GUI"] == "function"
|
|
45
|
+
) {
|
|
46
|
+
// console.log("Creating lil");
|
|
47
|
+
return new lil.GUI(props);
|
|
48
|
+
} else if (
|
|
49
|
+
globalThis.hasOwnProperty("dat") &&
|
|
50
|
+
typeof globalThis["dat"] == "object" &&
|
|
51
|
+
globalThis["dat"].hasOwnProperty("gui") &&
|
|
52
|
+
typeof globalThis["dat"]["gui"] == "object"
|
|
53
|
+
) {
|
|
54
|
+
// console.log("Creating dat.gui");
|
|
55
|
+
return new dat.gui.GUI(props);
|
|
56
|
+
} else {
|
|
57
|
+
console.warn("Warning: cannot create GUI. Nor dat.gui not lil-gui seem present.");
|
|
58
|
+
return null;
|
|
47
59
|
}
|
|
48
60
|
};
|
|
49
61
|
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
.
|
|
99
|
-
.
|
|
100
|
-
.
|
|
101
|
-
|
|
102
|
-
})
|
|
103
|
-
.title("Specifies a factor for the current height.")
|
|
104
|
-
.listen();
|
|
105
|
-
fold00
|
|
106
|
-
.add(pb.config, "cssScaleX")
|
|
107
|
-
.min(0.01)
|
|
108
|
-
.step(0.01)
|
|
109
|
-
.max(1.0)
|
|
110
|
-
.onChange(function () {
|
|
111
|
-
if (_self.config.cssUniformScale) _self.config.cssScaleY = _self.config.cssScaleX;
|
|
112
|
-
_self.updateCSSscale();
|
|
113
|
-
})
|
|
114
|
-
.title("Specifies the visual x scale (CSS).")
|
|
115
|
-
.listen();
|
|
116
|
-
fold00
|
|
117
|
-
.add(pb.config, "cssScaleY")
|
|
118
|
-
.min(0.01)
|
|
119
|
-
.step(0.01)
|
|
120
|
-
.max(1.0)
|
|
121
|
-
.onChange(function () {
|
|
122
|
-
if (_self.config.cssUniformScale) _self.config.cssScaleX = _self.config.cssScaleY;
|
|
123
|
-
_self.updateCSSscale();
|
|
124
|
-
})
|
|
125
|
-
.title("Specifies the visual y scale (CSS).")
|
|
126
|
-
.listen();
|
|
127
|
-
fold00
|
|
128
|
-
.add(pb.config, "cssUniformScale")
|
|
129
|
-
.onChange(function () {
|
|
130
|
-
if (_self.config.cssUniformScale) _self.config.cssScaleY = _self.config.cssScaleX;
|
|
131
|
-
_self.updateCSSscale();
|
|
132
|
-
})
|
|
133
|
-
.title("CSS uniform scale (x-scale equlsa y-scale).");
|
|
134
|
-
fold00.add(pb.config, "setToRetina").name("Set to highres fullsize").title("Set canvas to high-res retina resoultion (x2).");
|
|
62
|
+
var _tryDetectMobileDevice = function () {
|
|
63
|
+
return globalThis.hasOwnProperty("isMobileDevice") && typeof globalThis["isMobileDevice"] == "function" && isMobileDevice();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var _tryGetGUISizeToggler = function (gui, dummyConfig) {
|
|
67
|
+
if (!gui) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
if (globalThis.hasOwnProperty("guiSizeToggler") && typeof globalThis["guiSizeToggler"] == "function") {
|
|
71
|
+
return guiSizeToggler(gui, dummyConfig, { transformOrigin: "top right" });
|
|
72
|
+
} else {
|
|
73
|
+
console.warn("Warning: cannot create GUI's double size checkbox. guiSizeToggler is not present.");
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var createGuiFun = function (pb, props) {
|
|
79
|
+
var dummy = {
|
|
80
|
+
resetOffset: function () {
|
|
81
|
+
var viewport = pb.viewport();
|
|
82
|
+
pb.setOffset({ x: (viewport.width / 2.0) * pb.draw.scale.x, y: (viewport.height / 2.0) * pb.draw.scale.y });
|
|
83
|
+
pb.redraw();
|
|
84
|
+
},
|
|
85
|
+
resetScale: function () {
|
|
86
|
+
pb.setZoom(1.0, 1.0, new Vertex(0, 0));
|
|
87
|
+
pb.redraw();
|
|
88
|
+
},
|
|
89
|
+
guiDoubleSize: false
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Try to initialise dat.gui (old demos) or lil-gui (new demos). They have the ~same~ signature.
|
|
93
|
+
var gui = _tryGetGUIInstance(props);
|
|
94
|
+
var mobileDevice = _tryDetectMobileDevice();
|
|
95
|
+
var guiSize = _tryGetGUISizeToggler(gui, dummy);
|
|
96
|
+
if (mobileDevice && guiSize) {
|
|
97
|
+
dummy.guiDoubleSize = true;
|
|
98
|
+
guiSize.update();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var _self = pb;
|
|
102
|
+
if (guiSize) {
|
|
103
|
+
gui
|
|
104
|
+
.add(dummy, "guiDoubleSize")
|
|
105
|
+
.name("doubleGUISize")
|
|
106
|
+
.onChange(function () {
|
|
107
|
+
guiSize.update();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
var fold0 = gui.addFolder("Editor settings");
|
|
111
|
+
fold0.close(); // important only for lil-gui
|
|
112
|
+
var fold00 = fold0.addFolder("Canvas size");
|
|
113
|
+
fold00.close(); // important only for lil-gui
|
|
135
114
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
115
|
+
fold00
|
|
116
|
+
.add(pb.config, "fullSize")
|
|
117
|
+
.onChange(function () {
|
|
118
|
+
_self.resizeCanvas();
|
|
119
|
+
})
|
|
120
|
+
.title("Toggles the fullpage mode.")
|
|
121
|
+
.listen();
|
|
122
|
+
fold00
|
|
123
|
+
.add(pb.config, "fitToParent")
|
|
124
|
+
.onChange(function () {
|
|
125
|
+
_self.resizeCanvas();
|
|
126
|
+
})
|
|
127
|
+
.title("Toggles the fit-to-parent mode to fit to parent container (overrides fullsize).")
|
|
128
|
+
.listen();
|
|
129
|
+
fold00
|
|
130
|
+
.add(pb.config, "defaultCanvasWidth")
|
|
131
|
+
.min(1)
|
|
132
|
+
.step(10)
|
|
133
|
+
.onChange(function () {
|
|
134
|
+
_self.resizeCanvas();
|
|
135
|
+
})
|
|
136
|
+
.title("Specifies the fallback width.");
|
|
137
|
+
fold00
|
|
138
|
+
.add(pb.config, "defaultCanvasHeight")
|
|
139
|
+
.min(1)
|
|
140
|
+
.step(10)
|
|
141
|
+
.onChange(function () {
|
|
142
|
+
_self.resizeCanvas();
|
|
143
|
+
})
|
|
144
|
+
.title("Specifies the fallback height.");
|
|
145
|
+
fold00
|
|
146
|
+
.add(pb.config, "canvasWidthFactor")
|
|
147
|
+
.min(0.1)
|
|
148
|
+
.step(0.1)
|
|
149
|
+
.max(10)
|
|
150
|
+
.onChange(function () {
|
|
151
|
+
_self.resizeCanvas();
|
|
152
|
+
})
|
|
153
|
+
.title("Specifies a factor for the current width.")
|
|
154
|
+
.listen();
|
|
155
|
+
fold00
|
|
156
|
+
.add(pb.config, "canvasHeightFactor")
|
|
157
|
+
.min(0.1)
|
|
158
|
+
.step(0.1)
|
|
159
|
+
.max(10)
|
|
160
|
+
.onChange(function () {
|
|
161
|
+
_self.resizeCanvas();
|
|
162
|
+
})
|
|
163
|
+
.title("Specifies a factor for the current height.")
|
|
164
|
+
.listen();
|
|
165
|
+
fold00
|
|
166
|
+
.add(pb.config, "cssScaleX")
|
|
167
|
+
.min(0.01)
|
|
168
|
+
.step(0.01)
|
|
169
|
+
.max(1.0)
|
|
170
|
+
.onChange(function () {
|
|
171
|
+
if (_self.config.cssUniformScale) _self.config.cssScaleY = _self.config.cssScaleX;
|
|
172
|
+
_self.updateCSSscale();
|
|
173
|
+
})
|
|
174
|
+
.title("Specifies the visual x scale (CSS).")
|
|
175
|
+
.listen();
|
|
176
|
+
fold00
|
|
177
|
+
.add(pb.config, "cssScaleY")
|
|
178
|
+
.min(0.01)
|
|
179
|
+
.step(0.01)
|
|
180
|
+
.max(1.0)
|
|
181
|
+
.onChange(function () {
|
|
182
|
+
if (_self.config.cssUniformScale) _self.config.cssScaleX = _self.config.cssScaleY;
|
|
183
|
+
_self.updateCSSscale();
|
|
184
|
+
})
|
|
185
|
+
.title("Specifies the visual y scale (CSS).")
|
|
186
|
+
.listen();
|
|
187
|
+
fold00
|
|
188
|
+
.add(pb.config, "cssUniformScale")
|
|
189
|
+
.onChange(function () {
|
|
190
|
+
if (_self.config.cssUniformScale) _self.config.cssScaleY = _self.config.cssScaleX;
|
|
191
|
+
_self.updateCSSscale();
|
|
192
|
+
})
|
|
193
|
+
.title("CSS uniform scale (x-scale equlsa y-scale).");
|
|
194
|
+
fold00.add(pb.config, "setToRetina").name("Set to highres fullsize").title("Set canvas to high-res retina resoultion (x2).");
|
|
167
195
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
196
|
+
var fold01 = fold0.addFolder("Draw settings");
|
|
197
|
+
fold01.close(); // important only for lil-gui
|
|
198
|
+
|
|
199
|
+
fold01
|
|
200
|
+
.add(pb.drawConfig, "drawBezierHandlePoints")
|
|
201
|
+
.onChange(function () {
|
|
202
|
+
_self.redraw();
|
|
203
|
+
})
|
|
204
|
+
.title("Draw Bézier handle points.");
|
|
205
|
+
fold01
|
|
206
|
+
.add(pb.drawConfig, "drawBezierHandleLines")
|
|
207
|
+
.onChange(function () {
|
|
208
|
+
_self.redraw();
|
|
209
|
+
})
|
|
210
|
+
.title("Draw Bézier handle lines.");
|
|
211
|
+
fold01
|
|
212
|
+
.add(pb.drawConfig, "drawHandlePoints")
|
|
213
|
+
.onChange(function () {
|
|
214
|
+
_self.redraw();
|
|
215
|
+
})
|
|
216
|
+
.title("Draw handle points (overrides all other settings).");
|
|
217
|
+
fold01
|
|
218
|
+
.add(pb.drawConfig, "drawHandleLines")
|
|
219
|
+
.onChange(function () {
|
|
220
|
+
_self.redraw();
|
|
221
|
+
})
|
|
222
|
+
.title("Draw handle lines in general (overrides all other settings).");
|
|
223
|
+
fold01
|
|
224
|
+
.add(pb.drawConfig, "drawVertices")
|
|
225
|
+
.onChange(function () {
|
|
226
|
+
_self.redraw();
|
|
227
|
+
})
|
|
228
|
+
.title("Draw vertices in general.");
|
|
229
|
+
|
|
230
|
+
const fold0100 = fold01.addFolder("Colors and Lines");
|
|
231
|
+
fold0100.close(); // important only for lil-gui
|
|
232
|
+
|
|
233
|
+
const _addDrawConfigElement = function (fold, basePath, conf) {
|
|
234
|
+
for (var i in conf) {
|
|
235
|
+
if (typeof conf[i] == "object") {
|
|
236
|
+
if (conf[i].hasOwnProperty("color")) {
|
|
237
|
+
try {
|
|
238
|
+
fold
|
|
239
|
+
.addColor(conf[i], "color")
|
|
240
|
+
.onChange(function () {
|
|
241
|
+
_self.redraw();
|
|
242
|
+
})
|
|
243
|
+
.name(basePath + i + ".color")
|
|
244
|
+
.title(basePath + i + ".color")
|
|
245
|
+
.listen();
|
|
246
|
+
} catch (e) {
|
|
247
|
+
console.error("[createGUI] Invalid color value, gui library cannot recognize.", conf[i]["color"]);
|
|
248
|
+
}
|
|
184
249
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
250
|
+
// console.log("basePath", basePath, i, conf[i], conf[i].hasOwnProperty("lineWidth"));
|
|
251
|
+
if (conf[i].hasOwnProperty("lineWidth")) {
|
|
252
|
+
try {
|
|
253
|
+
// console.log("adding ", basePath, i);
|
|
254
|
+
fold
|
|
255
|
+
.add(conf[i], "lineWidth")
|
|
256
|
+
.min(1)
|
|
257
|
+
.max(10)
|
|
258
|
+
.step(1)
|
|
259
|
+
.onChange(function () {
|
|
260
|
+
_self.redraw();
|
|
261
|
+
})
|
|
262
|
+
.name(basePath + i + ".lineWidth")
|
|
263
|
+
.title(basePath + i + ".lineWidth")
|
|
264
|
+
.listen();
|
|
265
|
+
// console.log("adding 2", basePath, i);
|
|
266
|
+
} catch (e) {
|
|
267
|
+
console.error("[createGUI] Invalid lineWidth value, gui library cannot recognize.", conf[i]["lineWidth"]);
|
|
268
|
+
}
|
|
204
269
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
270
|
+
for (var e in conf[i]) {
|
|
271
|
+
if (conf[i].hasOwnProperty(e) && typeof conf[i][e] == "object") {
|
|
272
|
+
// console.log(e);
|
|
273
|
+
_addDrawConfigElement(fold, (basePath != "" ? basePath + "." : "") + i + "." + e, conf[i]);
|
|
274
|
+
}
|
|
210
275
|
}
|
|
211
276
|
}
|
|
212
277
|
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
_addDrawConfigElement(fold0100, "", pb.drawConfig);
|
|
278
|
+
};
|
|
279
|
+
_addDrawConfigElement(fold0100, "", pb.drawConfig);
|
|
216
280
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
fold0
|
|
282
|
+
.add(pb.config, "scaleX")
|
|
283
|
+
.title("Scale x.")
|
|
284
|
+
.min(0.01)
|
|
285
|
+
.max(10.0)
|
|
286
|
+
.step(0.01)
|
|
287
|
+
.onChange(function () {
|
|
288
|
+
_self.draw.scale.x = _self.fill.scale.x = _self.config.scaleX;
|
|
289
|
+
_self.redraw();
|
|
290
|
+
})
|
|
291
|
+
.listen();
|
|
292
|
+
fold0
|
|
293
|
+
.add(pb.config, "scaleY")
|
|
294
|
+
.title("Scale y.")
|
|
295
|
+
.min(0.01)
|
|
296
|
+
.max(10.0)
|
|
297
|
+
.step(0.01)
|
|
298
|
+
.onChange(function () {
|
|
299
|
+
_self.draw.scale.y = _self.fill.scale.y = _self.config.scaleY;
|
|
300
|
+
_self.redraw();
|
|
301
|
+
})
|
|
302
|
+
.listen();
|
|
303
|
+
fold0
|
|
304
|
+
.add(pb.config, "offsetX")
|
|
305
|
+
.title("Offset x.")
|
|
306
|
+
.step(10.0)
|
|
307
|
+
.onChange(function () {
|
|
308
|
+
_self.draw.offset.x = _self.fill.offset.x = _self.config.offsetX;
|
|
309
|
+
_self.redraw();
|
|
310
|
+
})
|
|
311
|
+
.listen();
|
|
312
|
+
fold0
|
|
313
|
+
.add(pb.config, "offsetY")
|
|
314
|
+
.title("Offset y.")
|
|
315
|
+
.step(10.0)
|
|
316
|
+
.onChange(function () {
|
|
317
|
+
_self.draw.offset.y = _self.fill.offset.y = _self.config.offsetY;
|
|
318
|
+
_self.redraw();
|
|
319
|
+
})
|
|
320
|
+
.listen();
|
|
321
|
+
fold0
|
|
322
|
+
.add(pb.config, "drawOrigin")
|
|
323
|
+
.title("Draw the origin (0,0).")
|
|
324
|
+
.onChange(function () {
|
|
325
|
+
_self.redraw();
|
|
326
|
+
})
|
|
327
|
+
.listen();
|
|
328
|
+
fold0
|
|
329
|
+
.add(pb.config, "rasterGrid")
|
|
330
|
+
.title("Draw a fine raster instead a full grid.")
|
|
331
|
+
.onChange(function () {
|
|
332
|
+
_self.redraw();
|
|
333
|
+
})
|
|
334
|
+
.listen();
|
|
335
|
+
fold0
|
|
336
|
+
.add(pb.config, "drawRaster")
|
|
337
|
+
.title("If set to false no raster or grid will be drawn at all.")
|
|
338
|
+
.onChange(function () {
|
|
339
|
+
_self.redraw();
|
|
340
|
+
})
|
|
341
|
+
.listen();
|
|
342
|
+
fold0.add(pb.config, "redrawOnResize").title("Automatically redraw the data if window or canvas is resized.").listen();
|
|
343
|
+
fold0
|
|
344
|
+
.addColor(pb.config, "backgroundColor")
|
|
345
|
+
.onChange(function () {
|
|
346
|
+
_self.redraw();
|
|
347
|
+
})
|
|
348
|
+
.title("Choose a background color.");
|
|
349
|
+
fold0.add(dummy, "resetOffset").title("Reset the draw offset to (0,0).");
|
|
350
|
+
fold0.add(dummy, "resetScale").title("Reset the draw scale to (1.,1.).");
|
|
287
351
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
352
|
+
if (pb.config.enableSVGExport) {
|
|
353
|
+
var foldExport = gui.addFolder("Export");
|
|
354
|
+
foldExport.close(); // important only for lil-gui
|
|
355
|
+
foldExport.add(pb.config, "saveFile").name("SVG Image").title("Save as SVG.");
|
|
356
|
+
globalThis.utils.guiFolders["editor_settings.export"] = foldExport;
|
|
357
|
+
}
|
|
293
358
|
|
|
294
|
-
|
|
295
|
-
|
|
359
|
+
globalThis.utils.guiFolders["editor_settings"] = fold0;
|
|
360
|
+
globalThis.utils.guiFolders["draw_settings"] = fold01;
|
|
361
|
+
|
|
362
|
+
return gui;
|
|
363
|
+
};
|
|
296
364
|
|
|
297
|
-
return
|
|
298
|
-
}; // END creategui
|
|
365
|
+
return createGuiFun;
|
|
366
|
+
})(); // END creategui
|