|
1 | 1 | const EXAMPLE_SETTINGS = [
|
2 |
| - ['how to use: https://github.com/piebro/factorio-blueprint-visualizer/blob/master/draw_setting_documentation.md'], |
3 |
| - ['default settings', {'background': '#a2aebb', 'stroke': '#3f88c5', 'stroke-linecap': 'round', 'stroke-width': 0.3}], |
4 |
| - ['tiles', {'fill': '#a2fffb', 'stroke-width': 0.1}, {'allow': ['landfill'], 'size': 0.7}], |
5 |
| - ['tiles', {'fill': '#a2aefb', 'stroke-width': 0.1}, {'deny': ['landfill'], 'size': 0.7}], |
6 |
| - ['bbox', {'fill': '#ff0000', 'stroke': 'none'}, {'deny': ["pipes", "underground-pipes", "belts", "underground-belts"], 'scale': 0.75, 'rx': 0.1, 'ry': 0.1}], |
7 |
| - // ['bbox-selection', {'fill': '#00ff00', 'stroke': 'none'}, {'scale': 1}], |
8 |
| - // ['bbox-collision', {'fill': '#0000ff', 'stroke': 'none'}, {'scale': 1}], |
9 |
| - |
10 |
| - ['pipes', {'stroke': '#ff0000'}], |
11 |
| - ['underground-pipes', {'stroke': '#ff0000'}], |
12 |
| - ['belts', {'stroke': '#00ff00'}], |
13 |
| - ['underground-belts', {'stroke': '#00ff00'}], |
14 |
| - ['heat-pipes', {'stroke': '#ff0000'}], |
15 |
| - ['power-lines', {'stroke': '#ff0000'}], |
16 |
| - // ['green-wire-lines', {'stroke': '#ff0000'}], |
17 |
| - // ['red-wire-lines', {'stroke': '#ff0000'}], |
18 |
| - ['inserters', {'stroke': '#ff0000', 'stroke-width': 0.1}], |
19 |
| - ['rails', {'stroke': '#ff0000'}], |
20 |
| -]; |
| 2 | + ["how to use: https://github.com/piebro/factorio-blueprint-visualizer/blob/master/draw_setting_documentation.md"], |
| 3 | + ["default settings", {'background': '#a2aebb', 'stroke': 'none', 'stroke-linecap': 'round', 'stroke-width': 0.3}, {'scale': 0.85, 'rx': 0.1, 'ry': 0.1}], |
| 4 | + ["tiles", {'fill': '#420217', 'stroke': '#f3ffbd', 'stroke-width': 0.15}, {'deny': [], 'size': 0.7}], |
| 5 | + |
| 6 | + ["pipes", {'stroke': '#c84c09'}], |
| 7 | + ["underground-pipes", {'stroke': '#c84c09'}], |
| 8 | + ["belts", {'stroke': '#f3ffbd'}], |
| 9 | + ["underground-belts", {'stroke': '#f3ffbd'}], |
| 10 | + ["inserters", {'stroke': '#f3ffbd'}], |
| 11 | + |
| 12 | + ["bbox", {'fill': '#247ba0'}, {'deny': ["pipe", "pipe-to-ground", "belt", "inserter", "solar-panel", "accumulator", "asteroid-collector", "cargo-bay", "space-platform-hub", "thruster"]}], |
| 13 | + ["bbox", {'fill': '#ff1654'}, {'allow': ["solar-panel"]}], |
| 14 | + ["bbox", {'fill': '#436436'}, {'allow': ["accumulator"]}], |
| 15 | + ["bbox", {'fill': '#70c1b3'}, {'allow': ["cargo-bay"]}], |
| 16 | + ["bbox", {'fill': '#b2dbbf'}, {'allow': ["asteroid-collector", "thruster", "space-platform-hub"]}], |
| 17 | + |
| 18 | + ["heat-pipes", {'stroke': '#b2dbbf'}], |
| 19 | + ["power-lines", {'stroke': '#70c1b3'}], |
| 20 | + ["rails", {'stroke': '#faa275'}], |
| 21 | +] |
21 | 22 |
|
22 | 23 | const PREDEFINED_COLOR_PALETTES = [
|
23 | 24 | [
|
@@ -276,19 +277,12 @@ function settingsChangeProperty(settings, propertyName, changeFunc) {
|
276 | 277 | function settingsChangeColors(settings, colorCount = null, changeBackground = true) {
|
277 | 278 | settings = deepCopy(settings);
|
278 | 279 | const originalColors = {};
|
279 |
| - const keysThatHaveAColor = ["stroke", "fill"]; |
| 280 | + let keysThatHaveAColor = ["stroke", "fill"]; |
| 281 | + if (changeBackground) { |
| 282 | + keysThatHaveAColor.push("background"); |
| 283 | + } |
280 | 284 |
|
281 | 285 | for (let s of settings) {
|
282 |
| - // Handle background color |
283 |
| - if (changeBackground && s[0] === "background") { |
284 |
| - if (!(s[1] in originalColors)) { |
285 |
| - originalColors[s[1]] = [[s, 1]]; |
286 |
| - } else { |
287 |
| - originalColors[s[1]].push([s, 1]); |
288 |
| - } |
289 |
| - continue; |
290 |
| - } |
291 |
| - |
292 | 286 | // Only check for stroke/fill if s[1] is an object and not null
|
293 | 287 | if (typeof s[1] === 'object' && s[1] !== null) {
|
294 | 288 | for (let key of keysThatHaveAColor) {
|
|
0 commit comments