From 4049e2e6361d5ed9120f1edd02ef96ecc138fa6d Mon Sep 17 00:00:00 2001 From: Ulrich-Matthias Schäfer Date: Mon, 5 Nov 2018 15:12:58 +0100 Subject: rework of classes, make events on every object possible --- src/sugar.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/sugar.js') diff --git a/src/sugar.js b/src/sugar.js index e5d6b61..6465985 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -3,6 +3,7 @@ import Runner from './Runner.js' import SVGNumber from './SVGNumber.js' import Matrix from './Matrix.js' import Point from './Point.js' +import Element from './Element.js' import {registerMethods} from './methods.js' // Define list of available attributes for stroke and fill @@ -23,7 +24,7 @@ var sugar = { if (typeof o === 'undefined') { return this } - if (typeof o === 'string' || Color.isRgb(o) || (o && typeof o.fill === 'function')) { + if (typeof o === 'string' || Color.isRgb(o) || (o instanceof Element)) { this.attr(m, o) } else { // set all attributes from sugar.fill and sugar.stroke list @@ -37,7 +38,7 @@ var sugar = { return this } - registerMethods(['Element', 'Runner'], extension) + registerMethods(['Shape', 'Runner'], extension) }) registerMethods(['Element', 'Runner'], { @@ -140,7 +141,7 @@ registerMethods('Path', { } }) -registerMethods(['Parent', 'Runner'], { +registerMethods(['Element', 'Runner'], { // Set font font: function (a, v) { if (typeof a === 'object') { -- cgit v1.2.3