Skip to content

Commit

Permalink
Break apart iconparts
Browse files Browse the repository at this point in the history
So this breaks a lot of stuff and we end up with a lot of broken
symbols, but trust me, it is good in the long run, now we just need to
repair everything that I broke.
This will implement #162 and #104
  • Loading branch information
spatialillusions committed Jan 17, 2018
1 parent 882a329 commit d634af7
Show file tree
Hide file tree
Showing 22 changed files with 4,563 additions and 4,342 deletions.
30 changes: 4 additions & 26 deletions src/iconparts/2525b.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Icon parts for tactical points
import { defaultProperties } from "./shared-functions.js";

export default function(
iconParts,
metadata,
Expand Down Expand Up @@ -65,33 +66,10 @@ export default function(
"m 80,85 40,0 0,-20 -40,0 z m 20,-30 0,40 m -40,15 15,15 50,0 15,-15 -15,-15 -50,0 z"
}; //WAR.SBSUF.SUB.STN.ASWSUB

function defaultProperties(instructions) {
if (typeof instructions === "object") {
if (Array.isArray(instructions)) {
for (var i = 0; i < instructions.length; i++) {
defaultProperties.call(this, instructions[i]);
}
return;
}
instructions.icon = true;
if (instructions.type == "text") {
if (!instructions.hasOwnProperty("fontfamily"))
instructions.fontfamily = "Arial";
if (!instructions.hasOwnProperty("fontweight"))
instructions.fontweight = "bold";
if (!instructions.hasOwnProperty("textanchor"))
instructions.textanchor = "middle";
if (!instructions.hasOwnProperty("stroke")) instructions.stroke = false;
}
if (!instructions.hasOwnProperty("fill")) instructions.fill = iconColor;
if (!instructions.hasOwnProperty("stroke"))
instructions.stroke = iconColor;
return;
}
}
for (var key in icn) {
if (!icn.hasOwnProperty(key)) continue;
defaultProperties.call(this, icn[key]);
if (iconParts.hasOwnProperty(key)) console.warn("Override of: " + key);
defaultProperties.call(this, icn[key], iconColor);
iconParts[key] = icn[key];
}
}
Loading

0 comments on commit d634af7

Please sign in to comment.