Movatterモバイル変換


[0]ホーム

URL:


Context menu

Adding a context menu to map objects

This example shows how to add a context menu for the map and map objects. Map has a default context items to show the click position, centring the map and creating a circle. Circles have their own context menu item to remove them.

Code

In order to add context menu items, first you need to subscribe to contextmenu event. ContextMenuEvent has a special items property, where menu items are stored. Each menu item is an instance of H.util.ContextItem class.

By default new menu items does not replace the previous ones, instead all items are collected and displayed together. However you can easily modify the items array to change this behaviour.

Context items can be visually separated from each other by using the H.util.ContextItem.SEPARATOR.


[8]ページ先頭

©2009-2025 Movatter.jp