Skip to content

v0.1.1

Compare
Choose a tag to compare
@github-actions github-actions released this 08 Sep 09:17
· 69 commits to main since this release
ea84bd5

Patch Changes

  • 1935d2c: refactor: removed unused variable from the code

  • 5c56e28: fix: merge modeOptions param into the first argument of constructor to make the interface simple.

    In v0.1.0, it used the second argument of constructor to customise drawing options for each Terra Draw mode. The second argment was now merged into the first argument as shown in the below sample code.

    const drawControl = new MaplibreTerradrawControl({
    	// only show polgyon, line and select mode.
    	modes: ['polygon', 'linestring', 'select'],
    	modeOptions: {
    		select: new TerraDrawSelectMode({
    			flags: {
    				// only update polygon settings for select mode.
    				// default settings will be used for other geometry types
    				// in this case, line uses default options of the plugin.
    				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');