forked from organicmaps/organicmaps
[iOS] fix small tap area in Elevation Profile
https://jira.mail.ru/browse/MAPSME-13529
This commit is contained in:
parent
41d483ea40
commit
fc70d6832f
6 changed files with 28 additions and 20 deletions
|
@ -7,6 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
472644DE24400C0400B9C053 /* ExpandedTouchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472644DD24400C0300B9C053 /* ExpandedTouchView.swift */; };
|
||||
47375E3C2420E94E00FFCC49 /* ChartPresentationData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47375E392420E94C00FFCC49 /* ChartPresentationData.swift */; };
|
||||
47375E3E2420E94E00FFCC49 /* ChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47375E3B2420E94E00FFCC49 /* ChartData.swift */; };
|
||||
47375E4B2420E97100FFCC49 /* ChartXAxisView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47375E3F2420E96C00FFCC49 /* ChartXAxisView.swift */; };
|
||||
|
@ -22,6 +23,7 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
472644DD24400C0300B9C053 /* ExpandedTouchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandedTouchView.swift; sourceTree = "<group>"; };
|
||||
47375D962420D4DB00FFCC49 /* Chart.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Chart.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
47375D9A2420D4DB00FFCC49 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
47375E392420E94C00FFCC49 /* ChartPresentationData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartPresentationData.swift; sourceTree = "<group>"; };
|
||||
|
@ -122,6 +124,7 @@
|
|||
47375E492420E97100FFCC49 /* ChartPreviewView.swift */,
|
||||
47375E3F2420E96C00FFCC49 /* ChartXAxisView.swift */,
|
||||
47375E472420E96F00FFCC49 /* ChartYAxisView.swift */,
|
||||
472644DD24400C0300B9C053 /* ExpandedTouchView.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
@ -254,6 +257,7 @@
|
|||
47375E542420E97100FFCC49 /* ChartPreviewView.swift in Sources */,
|
||||
47375E3C2420E94E00FFCC49 /* ChartPresentationData.swift in Sources */,
|
||||
47375E4D2420E97100FFCC49 /* ChartView.swift in Sources */,
|
||||
472644DE24400C0400B9C053 /* ExpandedTouchView.swift in Sources */,
|
||||
47375E4F2420E97100FFCC49 /* ChartPointInfoView.swift in Sources */,
|
||||
47375E4E2420E97100FFCC49 /* ChartInfoView.swift in Sources */,
|
||||
);
|
||||
|
|
|
@ -13,7 +13,7 @@ protocol ChartInfoViewDelegate: AnyObject {
|
|||
func chartInfoView(_ view: ChartInfoView, didMoveToPoint pointX: CGFloat)
|
||||
}
|
||||
|
||||
class ChartInfoView: UIView {
|
||||
class ChartInfoView: ExpandedTouchView {
|
||||
weak var delegate: ChartInfoViewDelegate?
|
||||
|
||||
private let pointInfoView = ChartPointInfoView()
|
||||
|
@ -104,10 +104,6 @@ class ChartInfoView: UIView {
|
|||
fatalError()
|
||||
}
|
||||
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
bounds.insetBy(dx: -22, dy: 0).contains(point)
|
||||
}
|
||||
|
||||
func update(_ x: CGFloat? = nil) {
|
||||
guard bounds.width > 0 else { return }
|
||||
let x = x ?? pointsView.center.x
|
||||
|
|
|
@ -28,7 +28,7 @@ class TintView: UIView {
|
|||
}
|
||||
}
|
||||
|
||||
class ViewPortView: UIView {
|
||||
class ViewPortView: ExpandedTouchView {
|
||||
let maskLayer = CAShapeLayer()
|
||||
var tintView: TintView?
|
||||
|
||||
|
@ -58,14 +58,9 @@ class ViewPortView: UIView {
|
|||
result.usesEvenOddFillRule = true
|
||||
return result
|
||||
}
|
||||
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
let rect = bounds.insetBy(dx: -30, dy: 0)
|
||||
return rect.contains(point)
|
||||
}
|
||||
}
|
||||
|
||||
class ChartPreviewView: UIView {
|
||||
class ChartPreviewView: ExpandedTouchView {
|
||||
let previewContainerView = UIView()
|
||||
let viewPortView = ViewPortView()
|
||||
let leftBoundView = UIView()
|
||||
|
|
|
@ -7,7 +7,7 @@ enum ChartAnimation: TimeInterval {
|
|||
}
|
||||
|
||||
public class ChartView: UIView {
|
||||
let chartsContainerView = UIView()
|
||||
let chartsContainerView = ExpandedTouchView()
|
||||
let chartPreviewView = ChartPreviewView()
|
||||
let yAxisView = ChartYAxisView()
|
||||
let xAxisView = ChartXAxisView()
|
||||
|
@ -201,6 +201,11 @@ public class ChartView: UIView {
|
|||
chartsContainerView.frame = chartsFrame
|
||||
}
|
||||
|
||||
override public func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
let rect = bounds.insetBy(dx: -30, dy: 0)
|
||||
return rect.contains(point)
|
||||
}
|
||||
|
||||
@objc func onPinch(_ sender: UIPinchGestureRecognizer) {
|
||||
if sender.state == .began {
|
||||
pinchStartLower = xAxisView.lowerBound
|
||||
|
|
8
iphone/Chart/Chart/Views/ExpandedTouchView.swift
Normal file
8
iphone/Chart/Chart/Views/ExpandedTouchView.swift
Normal file
|
@ -0,0 +1,8 @@
|
|||
import UIKit
|
||||
|
||||
class ExpandedTouchView: UIView {
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
let rect = bounds.insetBy(dx: -30, dy: 0)
|
||||
return rect.contains(point)
|
||||
}
|
||||
}
|
|
@ -2902,19 +2902,19 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jKi-gT-ZfM">
|
||||
<rect key="frame" x="16" y="0.0" width="343" height="176"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="176"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jIS-0e-Ztd" customClass="ChartView" customModule="Chart">
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="176"/>
|
||||
<rect key="frame" x="16" y="0.0" width="343" height="176"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBrownColor" red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="jIS-0e-Ztd" firstAttribute="top" secondItem="jKi-gT-ZfM" secondAttribute="top" id="QeA-Yb-58l"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jIS-0e-Ztd" secondAttribute="trailing" id="XRb-7G-y3q"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jIS-0e-Ztd" secondAttribute="trailing" constant="16" id="XRb-7G-y3q"/>
|
||||
<constraint firstAttribute="bottom" secondItem="jIS-0e-Ztd" secondAttribute="bottom" id="g8g-f5-krt"/>
|
||||
<constraint firstItem="jIS-0e-Ztd" firstAttribute="leading" secondItem="jKi-gT-ZfM" secondAttribute="leading" id="khr-Sp-8jS"/>
|
||||
<constraint firstItem="jIS-0e-Ztd" firstAttribute="leading" secondItem="jKi-gT-ZfM" secondAttribute="leading" constant="16" id="khr-Sp-8jS"/>
|
||||
<constraint firstAttribute="height" constant="176" id="utH-YA-2pe"/>
|
||||
</constraints>
|
||||
</view>
|
||||
|
@ -3059,7 +3059,7 @@
|
|||
<constraint firstItem="g6D-fD-0Ug" firstAttribute="centerX" secondItem="GPk-XR-oL1" secondAttribute="centerX" id="YFV-Au-wTO"/>
|
||||
<constraint firstItem="hoy-lg-Wl9" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="GPk-XR-oL1" secondAttribute="trailing" constant="8" id="eP3-qC-a2f"/>
|
||||
<constraint firstItem="FIo-No-CbK" firstAttribute="leading" secondItem="ezp-sJ-36x" secondAttribute="leading" constant="16" id="eg2-uX-NgT"/>
|
||||
<constraint firstItem="jKi-gT-ZfM" firstAttribute="leading" secondItem="ezp-sJ-36x" secondAttribute="leading" constant="16" id="kKJ-Jg-wRO"/>
|
||||
<constraint firstItem="jKi-gT-ZfM" firstAttribute="leading" secondItem="ezp-sJ-36x" secondAttribute="leading" id="kKJ-Jg-wRO"/>
|
||||
<constraint firstItem="dQJ-fW-QVh" firstAttribute="baseline" secondItem="FIo-No-CbK" secondAttribute="baseline" id="kvI-gM-iyU"/>
|
||||
<constraint firstItem="ezp-sJ-36x" firstAttribute="trailing" secondItem="Xc9-ED-V4K" secondAttribute="trailing" constant="16" id="mxE-Mk-VH2"/>
|
||||
<constraint firstItem="bc9-z0-p88" firstAttribute="bottom" secondItem="FIo-No-CbK" secondAttribute="baseline" id="opM-hk-CFP"/>
|
||||
|
@ -3068,7 +3068,7 @@
|
|||
<constraint firstItem="jKi-gT-ZfM" firstAttribute="top" secondItem="ezp-sJ-36x" secondAttribute="top" id="ySA-vA-GW9"/>
|
||||
<constraint firstItem="GPk-XR-oL1" firstAttribute="centerY" secondItem="FIo-No-CbK" secondAttribute="centerY" id="yey-Sw-JqF"/>
|
||||
<constraint firstItem="FIo-No-CbK" firstAttribute="top" secondItem="Xc9-ED-V4K" secondAttribute="bottom" constant="21" id="zDN-ZF-3Ex"/>
|
||||
<constraint firstItem="ezp-sJ-36x" firstAttribute="trailing" secondItem="jKi-gT-ZfM" secondAttribute="trailing" constant="16" id="zN2-OH-sDZ"/>
|
||||
<constraint firstItem="ezp-sJ-36x" firstAttribute="trailing" secondItem="jKi-gT-ZfM" secondAttribute="trailing" id="zN2-OH-sDZ"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="ezp-sJ-36x"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
|
Loading…
Add table
Reference in a new issue