From f70968fe01a16cc7695ef298008d6a39d0c9dad2 Mon Sep 17 00:00:00 2001 From: Uwe Oestermeier Date: Fri, 7 Feb 2020 20:08:44 +0100 Subject: [PATCH] Changed scale --- dist/iwmlib.js | 80 +++++++++---------------------------------- dist/iwmlib.pixi.js | 32 ----------------- lib/card/highlight.js | 31 +++++++++-------- 3 files changed, 33 insertions(+), 110 deletions(-) diff --git a/dist/iwmlib.js b/dist/iwmlib.js index b54a9bb..6acd4a1 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -614,19 +614,6 @@ static toLine(event) { return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}` - let result = event.type; - let selector = this.selector(event.target); - result += ' selector: ' + selector; - if (event.target != document.querySelector(selector)) console.log('Cannot resolve', selector); - let keys = ['layerX', 'layerY', 'pageX', 'pageY', 'clientX', 'clientY']; - for (let key of keys) { - try { - result += ' ' + key + ':' + event[key]; - } catch (e) { - console.log('Invalid key: ' + key); - } - } - return result } static compareExtractedWithSimulated() { @@ -2646,25 +2633,6 @@ result[id] = this.getPosition(event); break } - // case 'TouchEvent': - // // Needs to be observed: Perhaps changedTouches are all we need. If so - // // we can remove the touchEventKey default parameter - // if (touchEventKey == 'all') { - // for(let t of event.targetTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // for(let t of event.changedTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // } - // else { - // for(let t of event.changedTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // } - // break - default: - break } return result } @@ -5759,8 +5727,6 @@ let bottom = parseFloat(this.element.style.bottom); this.element.style.bottom = bottom - delta.y + 'px'; break - default: - break } //console.log("onResize", this.onResize) if (this.onResize) { @@ -6183,8 +6149,6 @@ x = bbRight; if (!this.useEventPosWithBoundingBox) y = (bbTop + bbBottom) / 2; break - default: - break } } @@ -6240,8 +6204,6 @@ x += this.notchSize * 2; x += this.posOffset; break - default: - break } this.placeOrigin(x, y); } @@ -7989,6 +7951,9 @@ * @class Highlight * @extends {Object} */ + + const SCALE = 1.5; + class Highlight extends Object { static disableAnimations() { _HighlightEnabled = false; @@ -8037,12 +8002,12 @@ } } - static expand(obj, { scale = 2, duration = 3, stroke = 2, onComplete = null } = {}) { + 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: scale, + scale, onUpdate: () => { let scale = obj._gsTransform.scaleX; obj.setAttribute('stroke-width', stroke / scale); @@ -8078,20 +8043,20 @@ 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')) { - console.log("already zooming") - return - }*/ + /*if (circle.classList.contains('zooming')) { + console.log("already zooming") + return + }*/ let svgRoot = circle.closest('svg'); let circleGroup = circle.parentNode; @@ -8142,7 +8107,7 @@ return false } - static openHighlight(target, { animation = 0.5, scale = 2, onExpanded = null } = {}) { + static openHighlight(target, { animation = 0.5, scale = SCALE, onExpanded = null } = {}) { if (Highlight._isExpanded(target)) { console.log('Target is already expanded!'); return @@ -8287,7 +8252,7 @@ } svgGroup.appendChild(maskImage); - // svgGroup.appendChild(element) + // svgGroup.appendChild(element) return [mask, maskImage] } @@ -8309,7 +8274,7 @@ 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, { @@ -8328,7 +8293,7 @@ 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); @@ -8343,9 +8308,6 @@ Highlight.expandedClass = 'expanded'; - // TODO: @ue Is this constant necessary? - const enableNearestNeighborTaps = false; - /** * A class that collects static methods to maintain the states and parts of * EyeVisit like cards. @@ -9774,16 +9736,6 @@ article.appendChild(iconClone); } - if (enableNearestNeighborTaps) { - //look for nearby popups on tap - InteractionMapper.on('tap', indexbox, () => { - // console.log('Tap handler called', editable) - if (!editable) { - this.findNearbyPopups(event, card); - } - }); - } - const eventElements = [indexbox, iconClone, clone]; // Use the 'tap' event for closing. diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 950aa8f..6f33a24 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -1335,19 +1335,6 @@ static toLine(event) { return `${event.type} #${event.target.id} ${event.clientX} ${event.clientY}` - let result = event.type; - let selector = this.selector(event.target); - result += ' selector: ' + selector; - if (event.target != document.querySelector(selector)) console.log('Cannot resolve', selector); - let keys = ['layerX', 'layerY', 'pageX', 'pageY', 'clientX', 'clientY']; - for (let key of keys) { - try { - result += ' ' + key + ':' + event[key]; - } catch (e) { - console.log('Invalid key: ' + key); - } - } - return result } static compareExtractedWithSimulated() { @@ -6187,25 +6174,6 @@ result[id] = this.getPosition(event); break } - // case 'TouchEvent': - // // Needs to be observed: Perhaps changedTouches are all we need. If so - // // we can remove the touchEventKey default parameter - // if (touchEventKey == 'all') { - // for(let t of event.targetTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // for(let t of event.changedTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // } - // else { - // for(let t of event.changedTouches) { - // result[t.identifier.toString()] = this.getPosition(t) - // } - // } - // break - default: - break } return result } diff --git a/lib/card/highlight.js b/lib/card/highlight.js index 5811056..7d93766 100644 --- a/lib/card/highlight.js +++ b/lib/card/highlight.js @@ -27,6 +27,9 @@ function round(value) { * @class Highlight * @extends {Object} */ + +const SCALE = 1.5 + export default class Highlight extends Object { static disableAnimations() { _HighlightEnabled = false @@ -75,12 +78,12 @@ export default class Highlight extends Object { } } - static expand(obj, { scale = 2, duration = 3, stroke = 2, onComplete = null } = {}) { + 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: scale, + scale, onUpdate: () => { let scale = obj._gsTransform.scaleX obj.setAttribute('stroke-width', stroke / scale) @@ -116,20 +119,20 @@ 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')) { - console.log("already zooming") - return - }*/ + /*if (circle.classList.contains('zooming')) { + console.log("already zooming") + return + }*/ let svgRoot = circle.closest('svg') let circleGroup = circle.parentNode @@ -180,7 +183,7 @@ export default class Highlight extends Object { return false } - static openHighlight(target, { animation = 0.5, scale = 2, onExpanded = null } = {}) { + static openHighlight(target, { animation = 0.5, scale = SCALE, onExpanded = null } = {}) { if (Highlight._isExpanded(target)) { console.log('Target is already expanded!') return @@ -325,7 +328,7 @@ export default class Highlight extends Object { } svgGroup.appendChild(maskImage) - // svgGroup.appendChild(element) + // svgGroup.appendChild(element) return [mask, maskImage] } @@ -347,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, { @@ -366,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) @@ -379,4 +382,4 @@ export default class Highlight extends Object { } } -Highlight.expandedClass = 'expanded' +Highlight.expandedClass = 'expanded' \ No newline at end of file