车辆监控地图部分

This commit is contained in:
DDIsFriend
2023-12-22 17:59:33 +08:00
parent 11d838906f
commit 652f3145a8
71 changed files with 9317 additions and 8464 deletions

View File

@@ -0,0 +1,131 @@
//
// DDUIPanGestureRecognizer.swift
// DDUIGestureRecognizer
// Created by DDIsFriend on 2023/12/19.
import Foundation
open class DDUIPanGestureRecognizer : UIPanGestureRecognizer {
public enum PanGestureFromType {
case bottom,top
}
public struct PanGesValue {
public var from : PanGestureFromType = .bottom
public var minDisplayHeight : CGFloat = 0
public var maxDisplayHeight : CGFloat = 0
public var criticalValue : CGFloat?
public var isExpanded : Bool = false
internal var translationY : CGFloat = 0
internal var currentY : CGFloat = 0
}
public var panGesValue = PanGesValue.init()
///
/// - Parameter target: target
public init() {
super.init(target: nil, action: nil)
self.addTarget(self, action: #selector(panGesAction(ges: )))
}
/// targetaction
public override init(target: Any?, action: Selector?) {
super.init(target: target, action: action)
}
@objc fileprivate func panGesAction(ges: DDUIPanGestureRecognizer) {
guard let superView = ges.view?.superview else {
assert(false,"父类都没有,拖什么拖")
return
}
let superViewFrame = superView.frame
let viewFrame = ges.view?.frame ?? .zero
let superViewH = superViewFrame.size.height
let viewH = viewFrame.size.height
switch ges.panGesValue.from {
case .bottom:
/// viewyviewviewysuperViewyminYdeltaH
var minY = superViewH - ges.panGesValue.maxDisplayHeight
let deltaH = superViewH - viewH
if deltaH > minY {
minY = deltaH
}
/// viewy
var maxY = superViewH - ges.panGesValue.minDisplayHeight
if deltaH > maxY {
maxY = deltaH
}
var currentY : CGFloat = 0.0
switch ges.state {
case .began:
currentY = viewFrame.origin.y
break
case .changed:
/// changedchangeddeltaY
let translationPoint = ges.translation(in: ges.view)
let deltaY = translationPoint.y - ges.panGesValue.translationY
ges.panGesValue.translationY = translationPoint.y
currentY = (viewFrame.origin.y) + deltaY
/// y
if currentY < minY {
return
}
/// y
if currentY > maxY {
return
}
break
case .ended:
///
let criticalValue = ges.panGesValue.criticalValue ?? (ges.panGesValue.maxDisplayHeight / 2)
let criticalY = maxY - criticalValue
if ges.panGesValue.currentY < criticalY {
currentY = minY
///
ges.panGesValue.isExpanded = true
}else{
currentY = maxY
///
ges.panGesValue.isExpanded = false
}
ges.panGesValue.translationY = 0
break
default:
currentY = viewFrame.origin.y
break
}
ges.panGesValue.currentY = currentY
UIView.animate(withDuration: 0.1, animations: {
ges.view?.frame = CGRectMake(viewFrame.origin.x, currentY, viewFrame.size.width, viewFrame.size.height)
})
break
default:
break
}
}
}
extension UIView {
public func addPanGesture(from: DDUIPanGestureRecognizer.PanGestureFromType, minDisplayHeight: CGFloat, maxDisplayHeight: CGFloat, criticalValue: CGFloat? = nil) {
let pan = DDUIPanGestureRecognizer.init()
pan.panGesValue.from = from
pan.panGesValue.minDisplayHeight = minDisplayHeight
pan.panGesValue.maxDisplayHeight = maxDisplayHeight
pan.panGesValue.criticalValue = criticalValue
addGestureRecognizer(pan)
}
}

19
Pods/DDUIGestureRecognizer/LICENSE generated Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2023 DDIsFriend <DDIsFriend@163.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

29
Pods/DDUIGestureRecognizer/README.md generated Normal file
View File

@@ -0,0 +1,29 @@
# DDUIGestureRecognizer
[![CI Status](https://img.shields.io/travis/DDIsFriend/DDUIGestureRecognizer.svg?style=flat)](https://travis-ci.org/DDIsFriend/DDUIGestureRecognizer)
[![Version](https://img.shields.io/cocoapods/v/DDUIGestureRecognizer.svg?style=flat)](https://cocoapods.org/pods/DDUIGestureRecognizer)
[![License](https://img.shields.io/cocoapods/l/DDUIGestureRecognizer.svg?style=flat)](https://cocoapods.org/pods/DDUIGestureRecognizer)
[![Platform](https://img.shields.io/cocoapods/p/DDUIGestureRecognizer.svg?style=flat)](https://cocoapods.org/pods/DDUIGestureRecognizer)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Requirements
## Installation
DDUIGestureRecognizer is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'DDUIGestureRecognizer'
```
## Author
DDIsFriend, DDIsFriend@163.com
## License
DDUIGestureRecognizer is available under the MIT license. See the LICENSE file for more info.