java - How to implement a scrollable, zoomable map in JavaFX/ScalaFX? -
i implementing map computer game accessory; should show geography of computer game few informative overlays. wonder what's best way achieve in javafx, or more precisely scalafx.
right now, have naive implementation:
- i have tiles map in different zoom levels. each zoom level, arrange
imageview
s ingroup
, transform group, zoom levels use same coordinates. - a separate group same coordinates used overlays.
- i zoom using mouse wheel , make 1 zoom level visible, depending on current zoom.
- i pack
scrollpane
.
that has few limitations:
- all tiles, zoom levels, loaded @ startup. that's ugly, works in particular use case.
- using scrollpane works if map has limited bounds. again, fine here, not maps in general.
- the ux weird: scrollpane scrolls mouse wheel, while maps scroll per drag , drop; maps zoom mouse wheel or pinch zoom. it's critical zooming preserves "anchors" (mouse/touch positions) during gesture. (it nice mobile-ready out of box, that's dreaming right now...)
- different levels of detail in overlay, depending on current zoom, possible, not efficient or convenient.
obviously, 1 of approaches tried. this question mentions library eppleton, doesn't seem maintained, , blog used describe library doesn't exist anymore. also, seems focus on providing game engine, tile having meaning game; tile in map image, , overlay doesn't care 1 tile begins or ends.
to finish concrete question: there libraries or techniques can use fulfill needs? i'm interested in third bullet point (ux), guess if there's suitable approach, cover points 1 3.
one option not build use existing open source project, such openmapfx
Comments
Post a Comment