Comments (5)
@felixguendling why do you want to move the canvas element, and not the triangle within it? You could've sent the offset to webgl and use it to offset the triangle.
from elm-webgl.
@felixguendling, sorry. I see why you need it now, it is moved with the main map and you have to reposition it with the opposite offset.
from elm-webgl.
@w0rm thank you for looking into the problem.
Yes. That's the approach other implementations use, too. This way, I don't have to use the "move" callback commented out in the file: https://github.com/felixguendling/elm-map/blob/master/index.html#L24
If I use the "move" callback (and position the canvas outside, not as child DOM of the map), another undesired "effect" appears: the constant rerender is not exactly synchronous with the drag movement of the user. Thus, the triangle is not at the same geographical location which looks weird. Furthermore, the system load increases significantly when dragging the map around (laptop fan makes noise).
I think this is a problem with Elm Ports being asynchronous in general, making real-time JS interop hard. But perhaps there is a way to solve this specific problem without touching the Elm compiler?
Edit: I thought about implementing a simple tile-based map in Elm (which would result in synchronous updates!). But I think that's not an easy problem. So using an existing mature library like Leaflet was my first approach.
from elm-webgl.
This seems like a great topic to bring up on the elm-dev mailing list.
As for finding a work-around within elm-webgl, I don't see a good way of doing it. You'd have to decouple from Elm's VDOM render loop somehow, right?
from elm-webgl.
Thanks for the hint. I opened a discussion:
https://groups.google.com/forum/#!topic/elm-dev/lAEnpHQzS5c
from elm-webgl.
Related Issues (20)
- Repository field in elm-package.json affects correctness of generated Javascript HOT 2
- Drop elm- from package name
- Extract a task to load image into separate project
- Unify code formatting in the Native module HOT 2
- Add support to disable premultipliedAlpha HOT 7
- Examples lead to 404 HOT 2
- Package hardwired to elm-lang/core 4.0.0
- Nothing gets rendered until the program receives it's first message HOT 2
- Interactivity: Picking HOT 5
- Host examples on gh-pages? HOT 24
- Exploding textures cache HOT 1
- Is is possible to add constants to the vertex array data? HOT 5
- Support the advanced mode of google closure compiler HOT 3
- Provide the ability to load a texture without an implicit UNPACK_FLIP_Y_WEBGL HOT 1
- Provide the ability to render a mesh with supplied vertices and indices.
- Adding Elm 0.18 HOT 4
- Publish a version with deprecation notice
- Respect Evan's constraints on this package HOT 6
- Broken link in README HOT 1
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 elm-webgl.