Canvas extract blank during pointerdown event
See original GitHub issueI’m trying to extract a canvas from a sprite when it has been clicked or tapped. For some reason when I use the renderer’s extract all I get is an empty canvas with the proper width and height.
Here’s the essence of my code, I can provide the actual code if neccessary.
sprite.on("pointerdown", function (e) {
// results in the blank canvas with the dimensions of the sprite
var canvas = app.renderer.extract.canvas(sprite);
window.open(canvas.toDataUrl());
});
I from my tests, the extract will work on any other DisplayObject within the pointerdown event except for the DisplayObject that is the target of the event. The extract will also work on the sprite in question when I use it outside of the pointerdown event. I’m using v4.5.3 by the way.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Using Pointer Events - Web APIs | MDN
This guide demonstrates how to use pointer events and the HTML <canvas> element to build a multi-touch enabled drawing application.
Read more >Pointer Events - W3C
The events for handling generic pointer input look a lot like those for mouse: pointerdown , pointermove , pointerup , pointerover , pointerout ......
Read more >Incorrect mouse down states related to holding of multiple ...
If you hold left you get pointerdown, if you then press any other button no events are fired. Just if you release all...
Read more >WPF: Canvas mouse events not firing on empty space
A control with no background color set (explicitly or through styles etc) will default to having a background color of null - making...
Read more >CSS pointer-events property - W3Schools
The numbers in the table specify the first browser version that fully supports the property. Property. pointer-events, 2.0, 11.0, 3.6, 4.0, 9.0 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jordanhe2 Besides resetting sprite’s position you should also reset pivot, anchor, rotation and scale
Right now I can work around it by doing the following: