Closed edemaine closed 2 years ago
With the addition of svgtiler.require
, combining two existing mapping files in sequence (as in command line) or parallel (as in this issue) is now easy:
new Mappings(svgtiler.require(f1), svgtiler.require(f2))
[svgtiler.require(f1), svgtiler.require(f2)]
Currently, symbols defined by a later mapping file override symbols defined in earlier mapping files. I think this behavior is reasonable and intuitive as a default, but #33 makes me wonder about alternative approaches for overlays/underlays. For example:
To implement this, we could have a separate
CombineMapping
class, andMappings
would check allCombineMapping
s (and treat them like added<symbol>
s at the end), but use the current behavior for regularMapping
s. I wonder if the providedcontext
should also specify the "main"<symbol>
(in particular itswidth
andheight
) for these mappings.Alternatively, we could define combination to be the default behavior....
With #33 complete, we could combine two known mappings by wrapping them in an array. Perhaps we need an
svgtiler.require
to load the mapping defined by another file (.txt
or.js
or whatever) as aMapping
, and then someone wanting to combine could wrap them in an array. For example: