From 40315ee73d3020803eefac7f9295fac0f01a8c0b Mon Sep 17 00:00:00 2001 From: "Reuben K. Coutinho" <1557519+alt-ctrl-dev@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:28:19 +0800 Subject: [PATCH] Allowing multiple coordinate paths to be passed This can help support custom draw mode tools for multi point option --- src/modes/direct_select.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modes/direct_select.js b/src/modes/direct_select.js index 7ba82e9d5..b77ac5dd3 100644 --- a/src/modes/direct_select.js +++ b/src/modes/direct_select.js @@ -121,14 +121,17 @@ DirectSelect.onSetup = function(opts) { if (feature.type === Constants.geojsonTypes.POINT) { throw new TypeError('direct_select mode doesn\'t handle point features'); } - + let selectedCoordPaths = opts.coordPath ? [opts.coordPath] : []; + if (Array.isArray(opts.coordPath)) { + selectedCoordPaths = opts.coordPath; + } const state = { featureId, feature, dragMoveLocation: opts.startPos || null, dragMoving: false, canDragMove: false, - selectedCoordPaths: opts.coordPath ? [opts.coordPath] : [] + selectedCoordPaths }; this.setSelectedCoordinates(this.pathsToCoordinates(featureId, state.selectedCoordPaths));