Skip to content

v0.1.0

Compare
Choose a tag to compare
@github-actions github-actions released this 07 Sep 22:05
· 72 commits to main since this release
8d4bff6

Minor Changes

  • 4d9a435: feat: allows to overwrite default Terra Draw mode instances by using the second argument of constructor.

    For example, if you only want to use polygon control, and you want to disable draggable option and node insertion/deletion on an edge of a polygon, the setting can be as follows.

    const drawControl = new MaplibreTerradrawControl(
    	{
    		modes: ['polygon', 'select']
    	},
    	{
    		select: new TerraDrawSelectMode({
    			flags: {
    				polygon: {
    					feature: {
    						draggable: false, // users cannot drag to move polygon
    						rotateable: true,
    						scaleable: true,
    						coordinates: {
    							midpoints: false, // users cannot add a node on the middle of edge.
    							draggable: true,
    							deletable: false // users cannot delete a node.
    						}
    					}
    				}
    			}
    		})
    	}
    );
    map.addControl(drawControl, 'top-left');
  • 4d9a435: feat: allows to change the order of Terra Draw modes on the plugin.

    Now, an array of modes can be passed to the constructor of the plugin, and the mode controls will be added exactly the same order. You can also remove unnecessary modes from the array when you initialize the plugin.

    For instance, you can only add point and select control on the plugin like the below code.

    const drawControl = new MaplibreTerradrawControl({
    	modes: ['point', 'select']
    });
    map.addControl(drawControl, 'top-left');