-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically set properties on runtime using setProperties #1333
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0915920
update set properties
martinale14 1e4afd1
ios implementation and cleanup
martinale14 7a22754
Merge branch 'flutter-mapbox-gl:master' into master
martinale14 147a1d4
adding support symbol layer set properties
martinale14 7db5ada
Merge remote-tracking branch 'origin/master'
martinale14 f21482e
removing telemetry hide
martinale14 f6f31d1
adding circle layer set properties
martinale14 885dafa
symbol to circle
martinale14 39f61ef
add style layer
martinale14 b658466
on end handler
martinale14 3e1755b
adding guard
martinale14 c2e52ab
fix on ios bounds
martinale14 49d1517
Merge branch 'flutter-mapbox-gl:master' into master
martinale14 a629a23
adding padding to camera update
martinale14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
example/android/.settings/org.eclipse.buildship.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
arguments=--init-script /var/folders/x9/_754gdq53b1dqkmjk09_4q540000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/x9/_754gdq53b1dqkmjk09_4q540000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle | ||
auto.sync=false | ||
build.scans.enabled=false | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.4.2)) | ||
connection.project.dir= | ||
eclipse.preferences.version=1 | ||
gradle.user.home= | ||
java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home | ||
jvm.arguments= | ||
offline.mode=false | ||
override.workspace.settings=true | ||
show.console.view=true | ||
show.executions.view=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ class Convert { | |
} | ||
} | ||
|
||
class func parseCameraUpdate(cameraUpdate: [Any], mapView: MGLMapView) -> MGLMapCamera? { | ||
class func parseCameraUpdate(cameraUpdate: [Any], mapView: MGLMapView, completionHandler: (() -> Void)?, duration: TimeInterval?) -> MGLMapCamera? { | ||
guard let type = cameraUpdate[0] as? String else { return nil } | ||
switch type { | ||
case "newCameraPosition": | ||
|
@@ -89,15 +89,42 @@ class Convert { | |
guard let paddingTop = cameraUpdate[3] as? CGFloat else { return nil } | ||
guard let paddingRight = cameraUpdate[4] as? CGFloat else { return nil } | ||
guard let paddingBottom = cameraUpdate[5] as? CGFloat else { return nil } | ||
return mapView.cameraThatFitsCoordinateBounds( | ||
MGLCoordinateBounds.fromArray(bounds), | ||
edgePadding: UIEdgeInsets( | ||
top: paddingTop, | ||
left: paddingLeft, | ||
bottom: paddingBottom, | ||
right: paddingRight | ||
) | ||
) | ||
|
||
let newBounds: MGLCoordinateBounds = MGLCoordinateBounds.fromArray(bounds) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whats the intent of this change? why only on ios? |
||
|
||
let coordinates: [CLLocationCoordinate2D] = [ | ||
CLLocationCoordinate2D(latitude: newBounds.ne.latitude, longitude: newBounds.sw.longitude), | ||
newBounds.sw, | ||
CLLocationCoordinate2D(latitude: newBounds.sw.latitude, longitude: newBounds.ne.longitude), | ||
newBounds.ne | ||
] | ||
|
||
let padding : UIEdgeInsets = UIEdgeInsets( | ||
top: paddingTop, | ||
left: paddingLeft, | ||
bottom: paddingBottom, | ||
right: paddingRight | ||
) | ||
|
||
|
||
if let animDur = duration { | ||
mapView.setVisibleCoordinates(coordinates, | ||
count: UInt(coordinates.count), edgePadding: padding, direction: mapView.direction, | ||
duration: TimeInterval(animDur / 1000), | ||
animationTimingFunction: CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut), | ||
completionHandler: { | ||
if let completion = completionHandler { | ||
completion() | ||
} | ||
}) | ||
} else { | ||
mapView.setVisibleCoordinates(coordinates, count: UInt(coordinates.count), edgePadding: padding, animated: true) | ||
if let completion = completionHandler { | ||
completion() | ||
} | ||
} | ||
|
||
return nil | ||
case "newLatLngZoom": | ||
guard let coordinate = cameraUpdate[1] as? [Double] else { return nil } | ||
guard let zoom = cameraUpdate[2] as? Double else { return nil } | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to do this? Can’t you just the get the layer from the style?