import Point from '../../common/Point' ; import Widget from './Widget' ; declare var document ; export default class View extends Widget { constructor ( canvas ) { super ( null , canvas ) ; document . addEventListener ( "mousedown" , this . globalOnMouseDown ) ; document . addEventListener ( "mousemove" , this . globalOnMouseMove ) ; document . addEventListener ( "mouseup" , this . globalOnMouseUp ) ; } coordinate ( e , dom ) { let x = e . pageX - dom . offsetLeft , y = e . pageY - dom . offsetTop ; return new Point ( x , y ) ; } private globalOnMouseDown = ( e ) => { super . onMouseDown ( this . coordinate ( e , this . canvas ) ) ; } ; private globalOnMouseMove = ( e ) => { super . onMouseMove ( this . coordinate ( e , this . canvas ) ) ; } ; private globalOnMouseUp = ( e ) => { super . onMouseUp ( this . coordinate ( e , this . canvas ) ) ; } ; }