konvajs / ng2-konva

Angular & Canvas - JavaScript library for drawing complex canvas graphics using Angular.
http://rafaelescala.com/ng2-konva/
113 stars 32 forks source link

Click coordinates? #23

Closed ephes closed 5 years ago

ephes commented 5 years ago

I wonder whether there's a way to get the coordinates of a click?

ephes commented 5 years ago

Uh oh, missed the examples on the ng2-konva page. Getting click coordinates:

  // in class definition
  @ViewChild('stage') stage: KonvaComponent;
  // in click handler
   const {x, y} = this.stage.getStage().getPointerPosition();

For the drag star example the dragstart and end handlers are missing in the template. Otherwise all works fine now, thanks for the angular bindings :).