override public func zoomExtent() {
let mutableEnvelope = AGSMutableEnvelope()
if let esriMap = mapView as? AGSMapView {
var hasEnvelope = false
for layer in esriMap.mapLayers {
if let graphicsLayer = layer as? AGSGraphicsLayer, graphicsLayer.isVisible, graphicsLayer.graphicsCount > 0 {
mutableEnvelope.union(with: graphicsLayer.fullEnvelope)
hasEnvelope = true
}
}
if !hasEnvelope {
return
}
// Should be done with animation for this
let _min = CGPoint(x: mutableEnvelope.xmin, y: mutableEnvelope.ymin)
let _max = CGPoint(x: mutableEnvelope.xmax, y: mutableEnvelope.ymax)
let bigDiff = max(mutableEnvelope.xmax-mutableEnvelope.xmin, mutableEnvelope.ymax-mutableEnvelope.ymin)
let padding = max(bigDiff/5.0, 1000.0)
zoom(min: _min, max: _max, padding: padding, animated: true)
}
}