PHP Classes

File: assets/gallerytypes/viewerjs/src/js/events.js

Recommend this page to a friend!
  Classes of Goffy G   wgGallery   assets/gallerytypes/viewerjs/src/js/events.js   Download  
File: assets/gallerytypes/viewerjs/src/js/events.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: wgGallery
Image gallery module for XOOPS CMS
Author: By
Last change:
Date: 3 years ago
Size: 1,766 bytes
 

Contents

Class file image Download
import { EVENT_CLICK, EVENT_DRAG_START, EVENT_KEY_DOWN, EVENT_POINTER_DOWN, EVENT_POINTER_MOVE, EVENT_POINTER_UP, EVENT_RESIZE, EVENT_WHEEL, } from './constants'; import { addListener, removeListener, } from './utilities'; export default { bind() { const { element, viewer } = this; addListener(viewer, EVENT_CLICK, (this.onClick = this.click.bind(this))); addListener(viewer, EVENT_WHEEL, (this.onWheel = this.wheel.bind(this))); addListener(viewer, EVENT_DRAG_START, (this.onDragStart = this.dragstart.bind(this))); addListener( this.canvas, EVENT_POINTER_DOWN, (this.onPointerDown = this.pointerdown.bind(this)), ); addListener( element.ownerDocument, EVENT_POINTER_MOVE, (this.onPointerMove = this.pointermove.bind(this)), ); addListener( element.ownerDocument, EVENT_POINTER_UP, (this.onPointerUp = this.pointerup.bind(this)), ); addListener( element.ownerDocument, EVENT_KEY_DOWN, (this.onKeyDown = this.keydown.bind(this)), ); addListener(window, EVENT_RESIZE, (this.onResize = this.resize.bind(this))); }, unbind() { const { element, viewer } = this; removeListener(viewer, EVENT_CLICK, this.onClick); removeListener(viewer, EVENT_WHEEL, this.onWheel); removeListener(viewer, EVENT_DRAG_START, this.onDragStart); removeListener(this.canvas, EVENT_POINTER_DOWN, this.onPointerDown); removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onPointerMove); removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onPointerUp); removeListener(element.ownerDocument, EVENT_KEY_DOWN, this.onKeyDown); removeListener(window, EVENT_RESIZE, this.onResize); }, };