@@ -94,8 +94,6 @@ import CollaboratorPointers, { ClientPointer } from './CollaboratorPointers';
9494import { FollowIndicator } from './FollowIndicator' ;
9595import TemporalSlider from './TemporalSlider' ;
9696import { MainViewModel } from './mainviewmodel' ;
97- //import Modify from 'ol/interaction/Modify.js';
98- //import Snap from 'ol/interaction/Snap.js';
9997
10098
10199const drawGeometries = [ 'Point' , 'LineString' , 'Polygon' ] ;
@@ -409,18 +407,6 @@ export class MainView extends React.Component<IProps, IStates> {
409407 } ,
410408 } ) ) ;
411409
412- /* generate select, modify and snap interactions for features of layers already added to the Map */
413- this . _select = new Select ( ) ;
414- this . _modify = new Modify ( {
415- features : this . _select . getFeatures ( ) ,
416- } ) ;
417-
418- this . _Map . addInteraction ( this . _select ) ;
419- this . _Map . addInteraction ( this . _modify ) ;
420-
421- this . _select . setActive ( true ) ;
422- this . _modify . setActive ( true ) ;
423-
424410 /* Track changes of selected layers
425411 Get the vector source of the selected layer
426412 Edit the vector layer*/
@@ -2129,7 +2115,7 @@ export class MainView extends React.Component<IProps, IStates> {
21292115 } ) ) ;
21302116 } ;
21312117
2132- _getDrawSourceFromSelectedLayer = ( ) => {
2118+ _setDrawSourceFromSelectedLayer = ( ) => {
21332119 const selectedLayers =
21342120 this . _model ?. sharedModel . awareness . getLocalState ( ) ?. selected ?. value ;
21352121 if ( ! selectedLayers ) {
@@ -2190,9 +2176,6 @@ export class MainView extends React.Component<IProps, IStates> {
21902176 if ( this . _draw ) {
21912177 this . _removeDrawInteraction ( ) ;
21922178 }
2193- if ( this . _select ) {
2194- this . _removeSelectInteraction ( ) ;
2195- }
21962179 if ( this . _modify ) {
21972180 this . _removeModifyInteraction ( ) ;
21982181 }
@@ -2204,25 +2187,22 @@ export class MainView extends React.Component<IProps, IStates> {
22042187 type : this . _currentDrawGeometry ,
22052188 source : this . _currentVectorSource ,
22062189 } ) ;
2207- this . _select = new Select ( ) ;
22082190 this . _modify = new Modify ( {
2209- features : this . _select . getFeatures ( ) ,
2191+ source : this . _currentVectorSource ,
22102192 } ) ;
22112193 this . _snap = new Snap ( {
22122194 source : this . _currentVectorSource ,
22132195 } ) ;
22142196 this . _Map . addInteraction ( this . _draw ) ;
2215- this . _Map . addInteraction ( this . _select ) ;
22162197 this . _Map . addInteraction ( this . _modify ) ;
22172198 this . _Map . addInteraction ( this . _snap ) ;
22182199 this . _draw . setActive ( true ) ;
2219- this . _select . setActive ( false ) ;
2220- this . _modify . setActive ( false ) ;
2200+ this . _modify . setActive ( true ) ;
22212201 this . _snap . setActive ( true ) ;
22222202 } ;
22232203
22242204 _editVectorLayer = ( ) => {
2225- this . _getDrawSourceFromSelectedLayer ( ) ;
2205+ this . _setDrawSourceFromSelectedLayer ( ) ;
22262206 if ( this . _currentDrawLayerID ) {
22272207 this . _currentVectorSource = this . _getVectorSourceFromLayerID (
22282208 this . _currentDrawLayerID ,
@@ -2239,11 +2219,6 @@ export class MainView extends React.Component<IProps, IStates> {
22392219 this . _Map . removeInteraction ( this . _draw ) ;
22402220 } ;
22412221
2242- private _removeSelectInteraction = ( ) => {
2243- this . _select . setActive ( false ) ;
2244- this . _Map . removeInteraction ( this . _select ) ;
2245- } ;
2246-
22472222 private _removeSnapInteraction = ( ) => {
22482223 this . _snap . setActive ( false ) ;
22492224 this . _Map . removeInteraction ( this . _snap ) ;
@@ -2393,7 +2368,6 @@ export class MainView extends React.Component<IProps, IStates> {
23932368 private _draw : Draw ;
23942369 private _snap : Snap ;
23952370 private _modify : Modify ;
2396- private _select : Select ;
23972371 private _currentDrawLayerID : string | undefined ;
23982372 private _previousDrawLayerID : string | undefined ;
23992373 private _currentDrawSource : IJGISSource | undefined ;
0 commit comments