Closed sap-auto closed 4 years ago
Can you create a question on stack overflow linked to a shared git repo that demonstrates the problem and I can take a look?
Thanks @reblace for getting back to me, though i think i figured the problem sort of. Below are the details of the issue.
Used leaflet and leafletDraw directives in the div to enable the draw control but seems like somehow the draw control is added in the angular zone itself causing multiple change detection cycles while dragging.
Created a Stackblitz for demo https://stackblitz.com/edit/angular-9-starter-material-xjevte . Gif below will give you an idea, console.log("CD fired") was added in ngAfterViewChecked to log CD trigger
To me the problem seemed that the leafletDrawDirective is not adding the draw control OutsideAngular zone. I solved this for now by not utilising your package ngx-leaflet-draw but rather setting the draw control from the component itself by getting a reference of LeafletDirective using '@ViewChild and then adding the control to map in zone.runOutsideAngular.
I can create a git repo if further needed.
I appreciate the work done by you guys in creating the package, Thanks
In case a marker, if present on the map and we pan or zoom the map ChangeDetection is fired rapidly. Same in case a Rectangle or polygon etc are present on the map and in edit mode, while resize or move event, change detection is fired.
With the limited knowledge i have, i could not figure out the way to run it outside of angular. Need to stop these change detection cycles by running this outside the zone if possible, any help would be greatly appreciated