Improve Path#moveTo behavior()

Allowing it to be called multiple times before any other drawing commands.
This commit is contained in:
Jürg Lehni 2012-11-03 19:45:02 -07:00
parent 693b2f3af1
commit 07c0b6ce6a

View file

@ -1654,6 +1654,11 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
// are considered abstract methods of PathItem and need to be defined in
// all implementing classes.
moveTo: function(point) {
// moveTo should only be called at the beginning of paths. But it
// can ce called again if there is nothing drawn yet, in which case
// the first segment gets readjusted.
if (this._segments.length === 1)
this.removeSegment(0);
// Let's not be picky about calling moveTo() when not at the
// beginning of a path, just bail out:
if (!this._segments.length)