svg.js v3.0.0 Release Notes
Release Date: 2018-12-01 // over 5 years ago-
➕ Added
- ➕ added
text()
method toSVG.Path
to create a textPath from this path (#705) - ➕ added
SVG.HTMLNode
which is the object wrapped around html nodes to put something in them - ➕ added
dispatch()
method onSVG.Element
which returns the dispatched event for event cancelation (#550) - ➕ added
isRoot()
onSVG.Doc
(#809) - ➕ added a linter during the npm build process
- ➕ added
beziere()
andsteps()
to generate easing functions - ➕ added
insertAfter()
andinsertBefore
- ➕ added
SVG.Style
which can be created withstyle()
orfontface()
(#517) - ➕ added
EventTarget
which is a baseclass to get event abilities (#641) - ➕ added
Dom
which is a baseclass to get dom abilities - ➕ added
round()
which lets you round attribues from a node - ➕ added
ax(), ay(), amove()
to change texts x and y values directly (#787) - ➕ added possibility to pass attributes into a constructor like:
new SVG.Rect({width:100})
- ➕ added possibility to pass in additional attribues to element creators e.g.
canvas.rect({x:100})
orcanvas.rect(100, 100, {x:100})
(#796) - ➕ added
SVG.List
(#645) - ➕ added
words()
andelement()
toDom
because of (#935) - ➕ added lab, lch, hsl and cmyk color spaces (#790)
- ➕ added
random()
method onSVG.Color
to create random colors of different kinds (#939)
✂ Removed
- ✂ removed
SVG.Array.split()
function - ✂ removed workaround for browser bug with stroke-width
- ✂ removed polyfills
- ✂ removed
SVG.Set
in favour ofSVG.List
- ✂ removed feature to set style with css string (e.g. "fill:none;display:block;")
- ✂ removed
loaded()
anderror()
method onSVG.Image
(#706) - ✂ removed sub-pixel offset fix
- ✂ removed
SVG.Nested
(#809) - ✂ removed
show()
fromSVG.A
to avoid name clash (#802) - ✂ removed
size()
fromSVG.Text
to avoid name clash (#799) - ✂ removed
native()
function - ✂ removed
Bare
in favour ofDom
(#935) - ✂ removed
bower
support because it is deprecated
🔄 Changed
- gradients now have there corresponding node as type and not only radial/linear
SVG.Path.pointAt()
correctly returns anSVG.Point
now- replaced static reference to
masker
inSVG.Mask
with themasker()
method - replaced static reference to
clipper
inSVG.ClipPath
with theclipper()
method - replaced static reference to
targets
inSVG.Mask
andSVG.ClipPath
with thetargets()
method - 🚚 moved all regexes to
SVG.regex
- 🆕 new constructor signature for
SVG.Image
andload()
:container.image(src, callback) / image.load(src, callback)
(#706) - 💅 changed
style()
tocss()
. Now accepts array as input and returns object when no argument given (#517) - ids are not generated upon creation anymore. Instead they are generated when requested (#559)
SVG.extend()
now expects exactly one module or an array of modulesSVG.Text.path()
now returns an instance of SVG.TextPath (#705)- 🚚
SVG.Text.path()
does not move all contents to the textPath (#705) SVG.TextPath
now inherits fromSVG.Text
and can be manipulated the same way (#705)SVG.Text.textPath()
returns the first textPaths in the text element (#705)- 📇 renamed
SVG.Stop
constructorat()
onSVG.Gradient
tostop()
(#707) - 📇 renamed
fill()
method onSVG.Gradient
andSVG.Pattern
tourl()
(#708) - 📇 renamed
previous()
method toprev()
- 🐎 changed
childNodes
tochildren
(same forfirstChild
,lastChild
, ...) (#710) - changed it back because of performance drop - 🚚 moved
defs()
method fromSVG.Parent
toSVG.Element
SVG()
can be called with css selector, node or svg string, now. Without an argument it creates a newSVG.Doc()
(#646)add()
,put()
,addTo()
,putIn()
now excepts all arguments accepted bySVG()
- all
SVG.*
objects now can have a node as parameter when constructing - 0️⃣
SVG()
does not set a default size anymore - 0️⃣ default constructor now has an optional
node
argument which is used to consruct the object e.g.new SVG.Rect(rectNode)
- SVG.Elements constructor now tries to import svgjs:data from the node
SVG.on()
calls the listener in the context of the passed object. el.on always uses the svg.js object as contextSVG.on()/off()
andel.on()/off()
now accepts multiple comma or space separated events e.g. "mousedown, foo bar" (#727)- Matrices now apply transformations like
scale
,translate
, etc... by left multiplying them to simplify transformations - ⚡️ The way
transform()
works is now completely different. See the docs for more as soon as they are updated - 🔀 merged
SVG.Doc
andSVG.Nested
, addedisRoot()
onSVG.Doc()
(#809) - 📄 The fx module was completely reworked to be faster and less error prone. For more information on how to use it refer to the docs
- The whole lib is now splitted into es6 modules (#875)
Element.svg()
now can can replace the current node, can export the children of a node and can take an export modifier to change/replace the exported nodesungroup()
now breaks off one container and not more- 👯
clone()
does not add the clone to the dom anymore attr()
excepts array now to get multiple values at onceSVG.Text.rebuild()
now takes every font-size into account (#512)fill()
andstroke()
return the fill and stroke attribute when called as getter (#789)parents()
now gives back all parents until the passed one or documentImage
callback passes normalload
event instead of custom object (#931)- 📇 renamed
Doc
toSvg
anddoc()
toroot
(andtoDoc()/toRoot()
) (#932)
- ➕ added