StageXL icon indicating copy to clipboard operation
StageXL copied to clipboard

click (and touch?) events problem with large canvas size

Open frankpepermans opened this issue 8 years ago • 6 comments

I have a project where the canvas exceeds the boundaries of the browser window, and I show scroll bars.

Click events work fine as long as I do not scroll, as soon as I scroll, it seems that the offset X and Y are not calculated correctly.

My findings =>

  • start app, screen renders, canvas resizes and scroll bars show
  • I do not scroll, but place my mouse over a clickable item
  • Now I scroll down, so that the item moves up, since I leave my mouse cursor stationary, I would now click on nothing.
  • I click, and the item onMouseClick triggers, even though it has moved out of my mouse pointer's reach.

frankpepermans avatar Feb 18 '16 12:02 frankpepermans

Okay that sounds bad. I will take a look at it!

bp74 avatar Feb 18 '16 14:02 bp74

I was able to resolve it :)

It is not a stagexl issue directly, I am using StageRenderMode.ONCE, and I assume that you recalculate hit areas only upon materializing, because simply triggering a render on scroll, or switching to AUTO mode resolves it.

frankpepermans avatar Feb 20 '16 12:02 frankpepermans

Okay great :) Happy to hear that it is not a StageXL issue! Please don't hesitate to send other bug reports at any time.

bp74 avatar Feb 20 '16 12:02 bp74

Sorry I had only checked with RenderMode.Canvas2D, when I switch to WebGL, it still behaves funny

frankpepermans avatar Feb 21 '16 09:02 frankpepermans

The mouse events should work the same regardless if the renderer is Canvas2D or WebGL. It would help if you could provide a repro case, otherwise i would need to build my own.

bp74 avatar Feb 21 '16 09:02 bp74

Sure thing sorry :) https://github.com/frankpepermans/flow

Also having dart2js issues here, but that could be non stagexl stuff

frankpepermans avatar Feb 21 '16 10:02 frankpepermans