From 129672eb0f572a70f533fd5d804c972ef176fecc Mon Sep 17 00:00:00 2001 From: Severin Opel Date: Tue, 14 Apr 2020 12:14:40 +0200 Subject: [PATCH] Added options object to toggle function. --- lib/card/highlight.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/card/highlight.js b/lib/card/highlight.js index 7d93766..591307d 100644 --- a/lib/card/highlight.js +++ b/lib/card/highlight.js @@ -80,7 +80,7 @@ export default class Highlight extends Object { static expand(obj, { scale = SCALE, duration = 3, stroke = 2, onComplete = null } = {}) { if (obj == null) return - //console.log("expand") + //console.log("expand") obj.classList.add('zooming') TweenLite.to(obj, duration, { scale, @@ -119,17 +119,17 @@ export default class Highlight extends Object { static animateCircle(target, callback) { console.log('ANIMATE CIRCLE', this) - // ** DEBUG OUTPUTS ** + // ** DEBUG OUTPUTS ** let circle = target - // We need a unique id to ensure correspondence between circle, mask, and maskImage + // We need a unique id to ensure correspondence between circle, mask, and maskImage if (!circle.hasAttribute('id')) { _CircleIds += 1 circle.setAttribute('id', '@@' + _CircleIds) } let id = circle.getAttribute('id') TweenLite.set(circle, { transformOrigin: '50% 50%' }) - /*if (circle.classList.contains('zooming')) { + /*if (circle.classList.contains('zooming')) { console.log("already zooming") return }*/ @@ -228,12 +228,12 @@ export default class Highlight extends Object { } } - static toggleHighlight(node) { + static toggleHighlight(node, options = {}) { console.log('toggleHighlight', Highlight._isExpanded(node)) if (Highlight._isExpanded(node)) { - Highlight.closeHighlight(node) + Highlight.closeHighlight(node, options) } else { - Highlight.openHighlight(node) + Highlight.openHighlight(node, options) } } @@ -328,7 +328,7 @@ export default class Highlight extends Object { } svgGroup.appendChild(maskImage) - // svgGroup.appendChild(element) + // svgGroup.appendChild(element) return [mask, maskImage] } @@ -350,7 +350,7 @@ export default class Highlight extends Object { static closeHighlight(target, { animation = 0.5 } = {}) { target.classList.remove(Highlight.expandedClass) - // eslint-disable-next-line no-unused-vars + // eslint-disable-next-line no-unused-vars let [mask, maskImage] = Highlight._getSVGMask(target) console.log('Close Highlight', maskImage) TweenLite.to([target, maskImage], animation, { @@ -369,7 +369,7 @@ export default class Highlight extends Object { static _retrieveId(target) { let id = target.getAttribute('id') - // We need a unique id to ensure correspondence between circle, mask, and maskImage + // We need a unique id to ensure correspondence between circle, mask, and maskImage if (!id) { _CircleIds += 1 target.setAttribute('id', '@@' + _CircleIds) @@ -382,4 +382,4 @@ export default class Highlight extends Object { } } -Highlight.expandedClass = 'expanded' \ No newline at end of file +Highlight.expandedClass = 'expanded'