Comments (3)
Hi @lupos, if I understand correctly, you have a canvas with pt.js in a background div, and then on top there're other DOM elements which is blocking the mouse events, correct?
I think that's the default behaviors for DOM elements. One simple way I can think of is to apply CSS "pointer-events: none" on the top element, then the mouse events should pass through and go to the background element.
Alternatively, I think you can also listen for the mouse events in a parent element (that contains both bg and the top elements), and then dispatch the mouse events into the pt.js element. Something like this:
http://stackoverflow.com/questions/6157929/how-to-simulate-a-mouse-click-using-javascript
Hope this helps. Feel free to ask if you have other questions. Cheers!
from pt.
Thanks for the reply. Yes your second suggestion will work but I was just hoping there would be a API way to just call the methods of PT directly rather than faking/passing an event. Thanks again for the help and for the great library!
from pt.
I see. There's no direct API yet, since onMouseAction callbacks are based on events. It's a good idea to have these also as a function call though, since dispatching events are a bit of a pain :)
from pt.
Related Issues (20)
- CanvasSpace bgcolor HOT 1
- Add license to dist files HOT 1
- Broken links to demos from documentation page HOT 1
- Color's alpha property cannot be set by array HOT 2
- Add shaping functions HOT 1
- Clearer documentation and API for initializing CanvasSpace HOT 1
- CanvasSpace does not set its size HOT 1
- grid.canFit doesn't work on empty grid HOT 3
- Documentation url HOT 1
- How to destroy CanvasSpace? HOT 1
- Easing functions missing in docs HOT 2
- Make all demos accessible in mobile HOT 1
- Make it possible to pass DOM-object to CanvasSpace instead of id HOT 4
- Create a CanvasSpace with transparent color HOT 5
- Some classes cannot be imported in ES6 HOT 1
- npm scripts for development HOT 1
- on window resize HOT 1
- Do you have any guide for angular 5 ? HOT 2
- No Grid methods in 2017 version ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pt.