From 6794c5eedd7481658f14e6a64e5edbb6e1a2f16d Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Fri, 5 Jul 2019 13:57:52 +0200 Subject: [PATCH 1/2] Fixed conflict. --- dist/iwmlib.js | 85 +++------------------------------------------ dist/iwmlib.pixi.js | 8 ++--- 2 files changed, 7 insertions(+), 86 deletions(-) diff --git a/dist/iwmlib.js b/dist/iwmlib.js index f323825..ae99164 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -3815,38 +3815,6 @@ onMove = null } = {} ) { -<<<<<<< HEAD - this.onCapture = null; - this.element = element; - if (stopEvents === 'auto') { - /* - The events have to be stopped in Safari, otherwise the whole page will be zoomed with - a pinch gesture (preventDefault in method preventPinch). In order to enable the - movement of scatter objects, the touchmove event has to be bound again. - */ - if (Capabilities.isSafari) { - document.addEventListener( - 'touchmove', - event => this.preventPinch(event), - false - ); - stopEvents = false; - } else { - stopEvents = true; - } - } - this.stopEvents = stopEvents; - this.claimEvents = claimEvents; - if (touchAction !== null) { - Elements$1.setStyle(element, { touchAction }); - } - this.scatter = new Map(); - this.delegate = new InteractionMapper$1(element, this, { - useCapture, - mouseWheelElement: window - }); -======= ->>>>>>> a3f7eb0b3cc9f48cfee3ce6c45887bf25617d1bc let notchPosition = (switchPos && point.y < 50) ? "topCenter" : "bottomCenter"; @@ -4753,52 +4721,6 @@ } } -<<<<<<< HEAD - class DOMFlippable { - constructor(element, scatter, flip) { - // Set log to console.log or a custom log function - // define data structures to store our touchpoints in - - this.element = element; - this.flip = flip; - this.card = element.querySelector('.flipCard'); - this.front = element.querySelector('.front'); - this.back = element.querySelector('.back'); - this.flipped = false; - this.scatter = scatter; - this.onFrontFlipped = flip.onFrontFlipped; - this.onBackFlipped = flip.onBackFlipped; - this.onClose = flip.onClose; - this.onRemoved = flip.onRemoved; - this.onUpdate = flip.onUpdate; - - this.flipDuration = flip.flipDuration; - this.fadeDuration = flip.fadeDuration; - scatter.addTransformEventCallback(this.scatterTransformed.bind(this)); - console.log('lib.DOMFlippable', 5000); - TweenLite.set(this.element, { perspective: 5000 }); - TweenLite.set(this.card, { transformStyle: 'preserve-3d' }); - TweenLite.set(this.back, { rotationY: -180 }); - TweenLite.set([this.back, this.front], { - backfaceVisibility: 'hidden', - perspective: 5000 - }); - TweenLite.set(this.front, { visibility: 'visible' }); - this.infoBtn = element.querySelector('.infoBtn'); - this.backBtn = element.querySelector('.backBtn'); - this.closeBtn = element.querySelector('.closeBtn'); - /* Buttons are not guaranteed to exist. */ - if (this.infoBtn) { - InteractionMapper$1.on('tap', this.infoBtn, event => this.flip.start()); - this.enable(this.infoBtn); - } - if (this.backBtn) { - InteractionMapper$1.on('tap', this.backBtn, event => this.start()); - } - if (this.closeBtn) { - InteractionMapper$1.on('tap', this.closeBtn, event => this.close()); - this.enable(this.closeBtn); -======= /** * For a given zoom, a new scale is calculated, taking * min and max scale into account. @@ -4814,7 +4736,6 @@ if (scale < minScale) { scale = minScale; zoom = scale / this.scale; ->>>>>>> a3f7eb0b3cc9f48cfee3ce6c45887bf25617d1bc } if (scale > maxScale) { scale = maxScale; @@ -5065,6 +4986,11 @@ this.onCapture = null; this.element = element; if (stopEvents === 'auto') { + /* + The events have to be stopped in Safari, otherwise the whole page will be zoomed with + a pinch gesture (preventDefault in method preventPinch). In order to enable the + movement of scatter objects, the touchmove event has to be bound again. + */ if (Capabilities.isSafari) { document.addEventListener( 'touchmove', @@ -6020,7 +5946,6 @@ /* Buttons are not guaranteed to exist. */ if (this.infoBtn) { InteractionMapper$1.on('tap', this.infoBtn, event => this.flip.start()); - this.enable(this.infoBtn); } if (this.backBtn) { diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 1ebca3c..be3c34c 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -6046,10 +6046,6 @@ window.Capabilities = Capabilities; window.CapabilitiesTests = CapabilitiesTests; - /** Basic class for poppable elements that need to be closed as soon as one poppable is - * shown. - */ - /* eslint-disable no-unused-vars */ /** * A base class for scatter specific events. @@ -14748,7 +14744,7 @@ * @extends Popup * @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest} */ - class PopupMenu$1 extends Popup { + class PopupMenu extends Popup { /** * Creates an instance of a PopupMenu. @@ -15397,7 +15393,7 @@ window.Stylus = Stylus; window.Switch = Switch; window.Popup = Popup; - window.PopupMenu = PopupMenu$1; + window.PopupMenu = PopupMenu; window.Modal = Modal; window.Volatile = Volatile; window.Message = Message; From 8b4c6c201440d331b633ed9b032e4cc06ab56bc9 Mon Sep 17 00:00:00 2001 From: Uwe Oestermeier Date: Fri, 5 Jul 2019 14:11:43 +0200 Subject: [PATCH 2/2] Fixed doctest problems. --- dist/iwmlib.js | 5 +++-- dist/iwmlib.pixi.js | 8 ++++++-- lib/scatter.html | 22 +++++++++++----------- lib/scatter.js | 5 +++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/dist/iwmlib.js b/dist/iwmlib.js index 286c758..5a17a14 100644 --- a/dist/iwmlib.js +++ b/dist/iwmlib.js @@ -4985,10 +4985,11 @@ * @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent * pointer cancel events. Use null if the * the touch action should not be set. + * @param {DOM node} debugCanvas - Shows debug infos about touches if not null */ constructor( element, - { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none' } = {} + { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none', debugCanvas = null } = {} ) { this.onCapture = null; this.element = element; @@ -5020,7 +5021,7 @@ mouseWheelElement: window }); - if (typeof debugCanvas !== 'undefined') { + if (debugCanvas !== null) { requestAnimationFrame(dt => { this.showTouches(dt, debugCanvas); }); diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index eb0f1d2..ef8ed40 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -6053,6 +6053,10 @@ window.Capabilities = Capabilities; window.CapabilitiesTests = CapabilitiesTests; + /** Basic class for poppable elements that need to be closed as soon as one poppable is + * shown. + */ + /* eslint-disable no-unused-vars */ /** * A base class for scatter specific events. @@ -14829,7 +14833,7 @@ * @extends Popup * @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest} */ - class PopupMenu extends Popup { + class PopupMenu$1 extends Popup { /** * Creates an instance of a PopupMenu. @@ -15478,7 +15482,7 @@ window.Stylus = Stylus; window.Switch = Switch; window.Popup = Popup; - window.PopupMenu = PopupMenu; + window.PopupMenu = PopupMenu$1; window.Modal = Modal; window.Volatile = Volatile; window.Message = Message; diff --git a/lib/scatter.html b/lib/scatter.html index 4a3ad99..f3e04d7 100644 --- a/lib/scatter.html +++ b/lib/scatter.html @@ -13,9 +13,8 @@ debugCanvas.width = main.getBoundingClientRect().width let context = debugCanvas.getContext('2d') context.clearRect(0, 0, debugCanvas.width, debugCanvas.height) - let stage = scatterContainer.polygon - stage.draw(context, { stroke: '#0000FF'}) + stage.draw(context, { stroke: "#0000FF"}) for(let scatter of scatterContainer.scatter.values()) { let polygon = scatter.polygon polygon.draw(context, { stroke: '#0000FF'}) @@ -26,6 +25,7 @@ requestAnimationFrame((dt) => { drawPolygons() animatePolygons() + }) } @@ -81,6 +81,8 @@ app.run() animatePolygons() + +

Interactive Content

@@ -91,21 +93,19 @@ elements under or nearby the event position and calls the click handler. Thus ge can be disambiguated as moves, zooms. or taps.

-
- +
+
- A Link -
A Div with click handler
+ A Link +
A Div with click handler
diff --git a/lib/scatter.js b/lib/scatter.js index b947225..c0942cd 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -865,10 +865,11 @@ export class DOMScatterContainer { * @param {String} [touchAction=none] - CSS to set touch action style, needed to prevent * pointer cancel events. Use null if the * the touch action should not be set. + * @param {DOM node} debugCanvas - Shows debug infos about touches if not null */ constructor( element, - { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none' } = {} + { stopEvents = 'auto', claimEvents = true, useCapture = true, touchAction = 'none', debugCanvas = null } = {} ) { this.onCapture = null this.element = element @@ -900,7 +901,7 @@ export class DOMScatterContainer { mouseWheelElement: window }) - if (typeof debugCanvas !== 'undefined') { + if (debugCanvas !== null) { requestAnimationFrame(dt => { this.showTouches(dt, debugCanvas) })