Added more logging

This commit is contained in:
Sebastian Kupke 2022-11-08 13:42:50 +01:00
parent 89de46b0e6
commit 7965c8459b

View File

@ -533,6 +533,7 @@ export default class Card {
popup.placeAt(position) popup.placeAt(position)
InteractionMapper.on(this.interactionType, popup.element, () => { InteractionMapper.on(this.interactionType, popup.element, () => {
alert(1)
this._cleanup(context) this._cleanup(context)
}) })
@ -1064,6 +1065,7 @@ export default class Card {
// captured from the whole subcard. // captured from the whole subcard.
InteractionMapper.on(this.interactionType, zoomedFig, () => { InteractionMapper.on(this.interactionType, zoomedFig, () => {
alert(2)
this._cleanup(wrapper) this._cleanup(wrapper)
}) })
@ -1278,6 +1280,7 @@ export default class Card {
}, },
}) })
alert(3)
InteractionMapper.off(zoomedFig) InteractionMapper.off(zoomedFig)
} }
} }
@ -1327,7 +1330,9 @@ export default class Card {
/* Removes the 'default' cleanup on the card */ /* Removes the 'default' cleanup on the card */
clone.removeAttribute('onclick') clone.removeAttribute('onclick')
alert(4)
InteractionMapper.on(this.interactionType, clone, () => { InteractionMapper.on(this.interactionType, clone, () => {
alert(5)
this._cleanup(context) this._cleanup(context)
}) })
@ -1467,8 +1472,10 @@ export default class Card {
if (enableNearestNeighborTaps) { if (enableNearestNeighborTaps) {
//look for nearby popups on tap //look for nearby popups on tap
alert(6)
InteractionMapper.on('tap', indexbox, () => { InteractionMapper.on('tap', indexbox, () => {
// console.log('Tap handler called', editable) // console.log('Tap handler called', editable)
alert(7)
if (!editable) { if (!editable) {
this.findNearbyPopups(event, card) this.findNearbyPopups(event, card)
} }
@ -1480,7 +1487,9 @@ export default class 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.
alert(8)
InteractionMapper.on('tap', iconClone, () => { InteractionMapper.on('tap', iconClone, () => {
alert(9)
if (editable) { if (editable) {
let isDirty = mainController.askSaveNode() let isDirty = mainController.askSaveNode()
if (isDirty) { if (isDirty) {
@ -1662,6 +1671,7 @@ export default class Card {
let handler = `Card.openIndexCard(event, '${url}')` let handler = `Card.openIndexCard(event, '${url}')`
if (this.debug) console.log('File has changed', target, handler) if (this.debug) console.log('File has changed', target, handler)
alert(10)
//TODO If this is required, it should be accessing the interaction type. //TODO If this is required, it should be accessing the interaction type.
target.setAttribute('onclick', handler) target.setAttribute('onclick', handler)
} }
@ -2067,6 +2077,7 @@ export default class Card {
* @memberof Card * @memberof Card
*/ */
static registerEvent(context, types, element, callback) { static registerEvent(context, types, element, callback) {
alert(11)
InteractionMapper.on(types, element, callback) InteractionMapper.on(types, element, callback)
if (context._registeredEvents == null) context._registeredEvents = [] if (context._registeredEvents == null) context._registeredEvents = []
if (context._registeredEvents.indexOf(element) == -1) context._registeredEvents.push(element) if (context._registeredEvents.indexOf(element) == -1) context._registeredEvents.push(element)
@ -2082,6 +2093,7 @@ export default class Card {
*/ */
static unregisterAllEvents(context) { static unregisterAllEvents(context) {
let eventElements = this.getRegisteredEvents(context) let eventElements = this.getRegisteredEvents(context)
alert(12)
InteractionMapper.off(eventElements) InteractionMapper.off(eventElements)
} }
} }