Closed edemaine closed 2 years ago
Manually converting ids to url(#...)s for every def seems ugly:
id
url(#...)
def
https://github.com/edemaine/svgtiler/blob/61ad1d7bb8b940de2eb29191e7942c371cef648b/examples/grid-graph/path.coffee#L29
Let's have svgtiler.def instead return an object def with helpers:
svgtiler.def
def.id
def.url()
url(#id)
def.hash()
#id
<use href>
def.force()
def.used()
Manually converting
id
s tourl(#...)
s for everydef
seems ugly:https://github.com/edemaine/svgtiler/blob/61ad1d7bb8b940de2eb29191e7942c371cef648b/examples/grid-graph/path.coffee#L29
Let's have
svgtiler.def
instead return an objectdef
with helpers:def.id
: the raw id stringdef.url()
: string of the formurl(#id)
(for use in most SVG attributes or CSS)def.hash()
: string of the form#id
(for use in<use href>
)def.force()
(ordef.used()
?): mark this def as something that should be included in the final DOM.