GMap overlays editing

UI Components for React
Post Reply
YourJest
Posts: 2
Joined: 02 May 2017, 18:00

08 Feb 2018, 17:39

Hello! I started using th GMap component and I have a task to edit overlays. If overlay "editable" property is set to true, I can edit them, but I can't listen that event. How to handle event of editing or that feature is not available yet? I tried to do it with creating new Polygon every time mouse was clicked, but it is not very comfortable to use it.
UPD
I found the solution by myself. I bound google listeners for every path.

Code: Select all

  
 let newPolygon = new google.maps.Polygon({ paths: _pathsData,
                strokeOpacity: 0.5, strokeWeight: 1, fillColor: '#1976D2', fillOpacity: 0.35, editable: true});
 google.maps.event.addListener(newPolygon.getPath(), 'set_at', this.polyEdited);
 google.maps.event.addListener(newPolygon.getPath(),'insert_at', this.polyEdited);
 let _polygonData = [ newPolygon ];
 this.setState({polygonData: _polygonData});
 

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest