Open darylteo opened 4 years ago
Oops the video was set to private I have fixed this.
Here is another video showing another global timer firing every 2 seconds, causing the dragged annotation to reset each time.
Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { timer in
let randomNumber = Double.random(in: 1...100) / 100.0
regionLayer.fillOpacity = NSExpression(forConstantValue: randomNumber)
}
Based on analysis of code, it looks like any change to the layer invalidates the entire frontend
And when redrawing, the frontend does not take into account that an annotation is currently being dragged and redraws the annotation at it's original point.
We have considered using MGLSymbolStyleLayer to display the annotations, so that maybe the layer will not be affected by rendering on other layers, but alas this method does not support Drag Drop out of the box. And the Annotation itself is quite complex (with several different types of indicators). So we do want to stick to MGLAnnotationView and UIViews.
https://www.youtube.com/watch?v=Tt0anMYWf88&feature=youtu.be
Here is a demonstration of the behaviour being seen in an app my team is developing.
When dragging the annotation, we are trying to set the fillOpacity of the underlying polygon to show that it is a valid drop target. However, when setting the fillOpacity, the annotation jumps.
You can see the code we are using is not very far from the example provided.
To ensure that the issue can be isolated to the fillOpacity change, I isolated the call with a 1 second timer delay, and the video demonstrates that the issue occurs immediately after 1 second when the highlight appears.
Our team reports that Android does not have this issue.
Thank you very much for your support.
Steps to reproduce
Expected behavior
Polygon under the dragged annotation should be highlighted, and annotation remains under touch point.
Actual behavior
Annotation being dragged jumps back to start point.
Configuration
Mapbox SDK versions: 5.9.0 iOS/macOS versions: Catalina 10.15.4 Device/simulator models: iPhone 11 Pro Max Xcode version: 11.4.1