diff options
Diffstat (limited to 'src/modules/optional/sugar.js')
-rw-r--r-- | src/modules/optional/sugar.js | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/modules/optional/sugar.js b/src/modules/optional/sugar.js index 0da0fe4..0de2c04 100644 --- a/src/modules/optional/sugar.js +++ b/src/modules/optional/sugar.js @@ -87,16 +87,13 @@ registerMethods([ 'Element', 'Runner' ], { }, // Map flip to transform - flip: function (direction, around) { - var directionString = typeof direction === 'string' ? direction - : isFinite(direction) ? 'both' - : 'both' - var origin = (direction === 'both' && isFinite(around)) ? [ around, around ] - : (direction === 'x') ? [ around, 0 ] - : (direction === 'y') ? [ 0, around ] - : isFinite(direction) ? [ direction, direction ] - : [ 0, 0 ] - return this.transform({ flip: directionString, origin: origin }, true) + flip: function (direction = 'both', origin = 'center') { + if ('xybothtrue'.indexOf(direction) === -1) { + origin = direction + direction = 'both' + } + + return this.transform({ flip: direction, origin: origin }, true) }, // Opacity @@ -144,18 +141,6 @@ registerMethods([ 'Element', 'Runner' ], { } }) -registerMethods('Text', { - ax (x) { - return this.attr('x', x) - }, - ay (y) { - return this.attr('y', y) - }, - amove (x, y) { - return this.ax(x).ay(y) - } -}) - // Add events to elements const methods = [ 'click', 'dblclick', |