Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

After the stage is redrawn, the original event will be triggered multiple times. Is there a way to reset or refresh the stage? #41

Open
RangerGuan opened this issue Mar 29, 2022 · 4 comments

Comments

@RangerGuan
Copy link

    <ko-stage #stage [config]="configStage">
        <ko-layer #layer [config]="configLayer">
        </ko-layer>
    </ko-stage>

    this.stage.getStage().addEventListener(
      'touchstart mousedown',
      (evt) => {
@RangerGuan
Copy link
Author

Well, I had to remove the previous time listener before every redraw.
this.stage.getStage().removeEventListener('mousedown mouseup');

@yury-kopyl
Copy link

yury-kopyl commented Apr 5, 2023

@RangerGuan Why you use native event? ng2-konva have angular events - use it (http://rafaelescala.com/ng2-konva/#event)

@Jbz797
Copy link

Jbz797 commented Aug 31, 2023

Since the last update, the mouseup event on ko-stage trigger 2 times :

<div #koContainer class="ko-container" [ngStyle]="{ cursor: planState.cursor }">
  <ko-stage
    *ngIf="configStage"
    #stage
    [config]="configStage"
    (mousedown)="handStart()"
    (mousemove)="handMove()"
    (mouseup)="handEnd()"
    (touchmove)="handMove()"
    (touchstart)="handStart()"
    (wheel)="wheelStart($event)"
  >
    <ko-layer #layer />
  </ko-stage>
</div>

@Jbz797
Copy link

Jbz797 commented Sep 5, 2023

I confirm that the events are all called twice :

• Object { angularComponent: {…}, event: {…} }
• mousedown { target: canvas, buttons: 1, clientX: 1357, clientY: 269, layerX: 1324, layerY: 236 }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants