Added event parameter,

This commit is contained in:
Uwe Oestermeier 2019-08-01 19:30:07 +02:00
parent e72836e0f7
commit db2badfc0d
4 changed files with 37 additions and 23 deletions

View File

@ -4,8 +4,6 @@ circle {
stroke-width: 8px; stroke-width: 8px;
} }
mask circle { mask circle {
stroke-width: 0; stroke-width: 0;
fill: white; fill: white;

44
dist/iwmlib.js vendored
View File

@ -2621,6 +2621,8 @@
onMouseWheel(event) { onMouseWheel(event) {
if (this.capture(event) && this.target.onMouseWheel) { if (this.capture(event) && this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback')
} }
} }
@ -2830,6 +2832,8 @@
} }
if (this.target.onMouseWheel) { if (this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback', this.target)
} }
} }
} }
@ -5464,6 +5468,8 @@
Poppable.registrations = new Map(); Poppable.registrations = new Map();
/* eslint-disable no-console */
/** A Popup that shows text labels, images, or html /** A Popup that shows text labels, images, or html
*/ */
class Popup$1 extends Poppable { class Popup$1 extends Poppable {
@ -5645,6 +5651,7 @@
} }
for (let key in content) { for (let key in content) {
console.log('using', key, this.loaded);
switch (key) { switch (key) {
case 'selector': case 'selector':
break break
@ -5756,7 +5763,7 @@
handleClose(e) { handleClose(e) {
let closing = this.closingEvent(e); let closing = this.closingEvent(e);
if (closing) { if (closing) {
this.close(); this.close(e);
} else { } else {
this.setupCloseHandler(); this.setupCloseHandler();
} }
@ -5886,11 +5893,11 @@
/** Close and remove the Popup from the DOM tree. /** Close and remove the Popup from the DOM tree.
*/ */
close() { close(event) {
//console.log("Popup.close", this.closeCommand) //console.log("Popup.close", this.closeCommand)
this.unregister(this.context); this.unregister(this.context);
if (this.closeCommand) { if (this.closeCommand) {
this.closeCommand(this, () => this.remove()); this.closeCommand(this, () => this.remove(), event);
} else { } else {
this.remove(); this.remove();
} }
@ -7984,6 +7991,8 @@
/** To avoid problems with relative URL paths, we use inline data URI to load svg icons. */ /** To avoid problems with relative URL paths, we use inline data URI to load svg icons. */
const enableNearestNeighborTaps = false;
/** /**
* A class that collects static methods to maintain the states and parts of * A class that collects static methods to maintain the states and parts of
* EyeVisit like cards. * EyeVisit like cards.
@ -9452,6 +9461,16 @@
if (this.dynamicHeight) { if (this.dynamicHeight) {
article.appendChild(iconClone); 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);
}
});
}
// Use the 'tap' event for closing. // Use the 'tap' event for closing.
// Otherwise the subcard cannot be closed, // Otherwise the subcard cannot be closed,
// when another subcard is touched. // when another subcard is touched.
@ -10137,7 +10156,6 @@
} }
/* eslint-disable no-console */ /* eslint-disable no-console */
/* global TweenLite */
let _HighlightEnabled = true; let _HighlightEnabled = true;
let _CircleIds = 0; let _CircleIds = 0;
@ -10356,14 +10374,14 @@
return return
} }
let image = svgRoot.querySelector('image'); let image = svgRoot.querySelector('image');
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
let [mask, maskImage] = Highlight$1._getSVGMask(target, { let [mask, maskImage] = Highlight$1._getSVGMask(target, {
svgRoot, svgRoot,
image image
}); });
let center = Highlight$1._calculateCenterRelativeTo(target, image); let center = Highlight$1._calculateCenterRelativeTo(target, image);
console.log("_calculateCenterRelativeTo", center); console.log('_calculateCenterRelativeTo', center);
TweenLite.set(maskImage, { TweenLite.set(maskImage, {
transformOrigin: `${center.x} ${center.y}` transformOrigin: `${center.x} ${center.y}`
}); });
@ -10379,7 +10397,7 @@
} }
static toggleHighlight(node) { static toggleHighlight(node) {
console.log("toggleHighlight", Highlight$1._isExpanded(node)); console.log('toggleHighlight', Highlight$1._isExpanded(node));
if (Highlight$1._isExpanded(node)) { if (Highlight$1._isExpanded(node)) {
Highlight$1.closeHighlight(node); Highlight$1.closeHighlight(node);
} else { } else {
@ -10506,18 +10524,8 @@
return target.classList.contains(Highlight$1.expandedClass) return target.classList.contains(Highlight$1.expandedClass)
} }
static _setExpanded(target) {
target.classList.add(Highlight$1.expandedClass);
}
static _notExpanded(target) {
target.classList.remove(Highlight$1.expandedClass);
}
static closeHighlight(target, { animation = 0.5 } = {}) { static closeHighlight(target, { animation = 0.5 } = {}) {
target.classList.remove(Highlight$1.expandedClass);
Highlight$1._notExpanded(target);
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
let [mask, maskImage] = Highlight$1._getSVGMask(target); let [mask, maskImage] = Highlight$1._getSVGMask(target);
console.log('Close Highlight', maskImage); console.log('Close Highlight', maskImage);

4
dist/iwmlib.pixi.js vendored
View File

@ -6042,6 +6042,8 @@
onMouseWheel(event) { onMouseWheel(event) {
if (this.capture(event) && this.target.onMouseWheel) { if (this.capture(event) && this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback')
} }
} }
@ -6251,6 +6253,8 @@
} }
if (this.target.onMouseWheel) { if (this.target.onMouseWheel) {
this.target.onMouseWheel(event); this.target.onMouseWheel(event);
} else {
//console.warn('Target has no onMouseWheel callback', this.target)
} }
} }
} }

View File

@ -1,3 +1,6 @@
/* eslint-disable no-console */
/* eslint-disable no-case-declarations */
/* eslint-disable no-unused-vars */
import { Elements } from './utils.js' import { Elements } from './utils.js'
import Poppable from './poppable.js' import Poppable from './poppable.js'
@ -182,6 +185,7 @@ export default class Popup extends Poppable {
} }
for (let key in content) { for (let key in content) {
console.log('using', key, this.loaded)
switch (key) { switch (key) {
case 'selector': case 'selector':
break break
@ -293,7 +297,7 @@ export default class Popup extends Poppable {
handleClose(e) { handleClose(e) {
let closing = this.closingEvent(e) let closing = this.closingEvent(e)
if (closing) { if (closing) {
this.close() this.close(e)
} else { } else {
this.setupCloseHandler() this.setupCloseHandler()
} }
@ -423,11 +427,11 @@ export default class Popup extends Poppable {
/** Close and remove the Popup from the DOM tree. /** Close and remove the Popup from the DOM tree.
*/ */
close() { close(event) {
//console.log("Popup.close", this.closeCommand) //console.log("Popup.close", this.closeCommand)
this.unregister(this.context) this.unregister(this.context)
if (this.closeCommand) { if (this.closeCommand) {
this.closeCommand(this, () => this.remove()) this.closeCommand(this, () => this.remove(), event)
} else { } else {
this.remove() this.remove()
} }