highlight touchpad widget border during resizing
This commit is contained in:
1 parent
57dac128e2
commit
023cc0b583
3 files changed
+64
-23
No files matched your search
@@ -2522,7 +2522,7 @@
|
|||||||
<viewControllerLayoutGuide type="bottom" id="eaS-aj-VtA"/>
|
<viewControllerLayoutGuide type="bottom" id="eaS-aj-VtA"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="Acw-S4-f8a">
|
<view key="view" contentMode="scaleToFill" id="Acw-S4-f8a">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="1300" height="1500"/>
|
<rect key="frame" x="0.0" y="0.0" width="1300" height="3000"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZU-G0-fgM" userLabel="Toolbar Root View" customClass="ToolBarContainerView">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZU-G0-fgM" userLabel="Toolbar Root View" customClass="ToolBarContainerView">
|
||||||
@@ -3483,16 +3483,16 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="330" height="31"/>
|
<rect key="frame" x="0.0" y="0.0" width="330" height="31"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lar-2o-R7c">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lar-2o-R7c">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="35" height="31"/>
|
<rect key="frame" x="0.0" y="0.0" width="10" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="35" id="Uly-QK-Ss9"/>
|
<constraint firstAttribute="width" constant="10" id="Uly-QK-Ss9"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2TR-Kd-ro4">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2TR-Kd-ro4">
|
||||||
<rect key="frame" x="35" y="0.0" width="90" height="31"/>
|
<rect key="frame" x="10" y="0.0" width="90" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="90" id="QKh-al-ndE"/>
|
<constraint firstAttribute="width" constant="90" id="QKh-al-ndE"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -3525,7 +3525,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BlQ-y7-iDS">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BlQ-y7-iDS">
|
||||||
<rect key="frame" x="125" y="0.0" width="5" height="31"/>
|
<rect key="frame" x="100" y="0.0" width="5" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="5" id="WKZ-kW-aww"/>
|
<constraint firstAttribute="width" constant="5" id="WKZ-kW-aww"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -3534,7 +3534,7 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cyH-Fh-vW6">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cyH-Fh-vW6">
|
||||||
<rect key="frame" x="130" y="0.0" width="90" height="31"/>
|
<rect key="frame" x="105" y="0.0" width="90" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="90" id="UeY-vl-Bq1"/>
|
<constraint firstAttribute="width" constant="90" id="UeY-vl-Bq1"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -3567,7 +3567,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ocb-R1-UYc">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ocb-R1-UYc">
|
||||||
<rect key="frame" x="220" y="0.0" width="5" height="31"/>
|
<rect key="frame" x="195" y="0.0" width="5" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="5" id="xI6-7Y-omo"/>
|
<constraint firstAttribute="width" constant="5" id="xI6-7Y-omo"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -3576,9 +3576,9 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aGh-QR-gBW">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aGh-QR-gBW">
|
||||||
<rect key="frame" x="225" y="0.0" width="100" height="31"/>
|
<rect key="frame" x="200" y="0.0" width="125" height="31"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="90" id="Osk-FF-3gf"/>
|
<constraint firstAttribute="width" constant="120" id="Osk-FF-3gf"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||||
<state key="normal" title="Button">
|
<state key="normal" title="Button">
|
||||||
@@ -3662,7 +3662,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<toolbarItems/>
|
<toolbarItems/>
|
||||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||||
<size key="freeformSize" width="1300" height="1500"/>
|
<size key="freeformSize" width="1300" height="3000"/>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="addButton" destination="fKN-ja-TRi" id="R2n-QF-aSj"/>
|
<outlet property="addButton" destination="fKN-ja-TRi" id="R2n-QF-aSj"/>
|
||||||
<outlet property="anchorModeSelector" destination="PSA-W8-aR5" id="8Et-5Y-7oF"/>
|
<outlet property="anchorModeSelector" destination="PSA-W8-aR5" id="8Et-5Y-7oF"/>
|
||||||
|
|||||||
@@ -105,8 +105,33 @@ import ObjectiveC.runtime
|
|||||||
private var comboKeyTimeIntervalMs: UInt32 = 0
|
private var comboKeyTimeIntervalMs: UInt32 = 0
|
||||||
|
|
||||||
@objc public var logicallyDown: Bool = false
|
@objc public var logicallyDown: Bool = false
|
||||||
@objc public var widthFactor: CGFloat = 1.0
|
|
||||||
@objc public var heightFactor: CGFloat = 1.0
|
@objc public var isBeingResized: Bool = false
|
||||||
|
@objc public var widthFactor: CGFloat = 1.0 {
|
||||||
|
didSet{
|
||||||
|
isBeingResized = true
|
||||||
|
self.resizeWidgetView()
|
||||||
|
if OnScreenWidgetView.editMode {self.highlightBorderDuringResizing()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@objc public var heightFactor: CGFloat = 1.0 {
|
||||||
|
didSet{
|
||||||
|
isBeingResized = true
|
||||||
|
self.resizeWidgetView()
|
||||||
|
if OnScreenWidgetView.editMode {self.highlightBorderDuringResizing()}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private func highlightBorderDuringResizing() {
|
||||||
|
if widgetType == .touchPad {
|
||||||
|
self.highlightBorder(highlighted: true, color: standardHighlightColor.cgColor)
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||||
|
if !self.isBeingResized {
|
||||||
|
self.highlightBorder(highlighted: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc public var componentSizeFactor: CGFloat = 2.88 {
|
@objc public var componentSizeFactor: CGFloat = 2.88 {
|
||||||
didSet{
|
didSet{
|
||||||
if self.isStickWheel {
|
if self.isStickWheel {
|
||||||
@@ -751,8 +776,8 @@ import ObjectiveC.runtime
|
|||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
// replace invalid factor values
|
// replace invalid factor values
|
||||||
if self.widthFactor == 0 {self.widthFactor = 1.0}
|
// if self.widthFactor == 0 {self.widthFactor = 1.0}
|
||||||
if self.heightFactor == 0 {self.heightFactor = 1.0}
|
// if self.heightFactor == 0 {self.heightFactor = 1.0}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
@@ -3522,9 +3547,11 @@ import ObjectiveC.runtime
|
|||||||
widget.isUserInteractionEnabled = false
|
widget.isUserInteractionEnabled = false
|
||||||
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
||||||
|| abs(widget.backgroundAlpha) < 0.1){
|
|| abs(widget.backgroundAlpha) < 0.1){
|
||||||
widget.highlightBorder(highlighted: true, color: UIColor.systemBlue.cgColor)
|
widget.highlightBorder(highlighted: folder.animatesTransition, color: UIColor.systemBlue.cgColor)
|
||||||
}
|
}
|
||||||
let duration = OnScreenWidgetView.enableFolderAnimation ? (folder.buttonMode == .slideAndHold ? 0.05 : widget.standardFoldingInterval) : 0
|
let duration = (OnScreenWidgetView.enableFolderAnimation && folder.animatesTransition)
|
||||||
|
? (folder.buttonMode == .slideAndHold ? 0.05 : widget.standardFoldingInterval)
|
||||||
|
: 0
|
||||||
UIView.animate(withDuration: duration, animations: {
|
UIView.animate(withDuration: duration, animations: {
|
||||||
widget.center = folder.center
|
widget.center = folder.center
|
||||||
},completion: { finished in
|
},completion: { finished in
|
||||||
@@ -3549,9 +3576,12 @@ import ObjectiveC.runtime
|
|||||||
widget.isHidden = false
|
widget.isHidden = false
|
||||||
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
||||||
|| abs(widget.backgroundAlpha) < 0.1){
|
|| abs(widget.backgroundAlpha) < 0.1){
|
||||||
widget.highlightBorder(highlighted: true, color: UIColor.systemBlue.cgColor)
|
widget.highlightBorder(highlighted: folder.animatesTransition, color: UIColor.systemBlue.cgColor)
|
||||||
}
|
}
|
||||||
UIView.animate(withDuration: OnScreenWidgetView.enableFolderAnimation ? (folder.buttonMode == .slideAndHold ? 0.05 : widget.standardFoldingInterval) : 0, animations: {
|
UIView.animate(withDuration: (OnScreenWidgetView.enableFolderAnimation && folder.animatesTransition)
|
||||||
|
? (folder.buttonMode == .slideAndHold ? 0.05 : widget.standardFoldingInterval)
|
||||||
|
: 0
|
||||||
|
, animations: {
|
||||||
widget.center = widget.storedCenter
|
widget.center = widget.storedCenter
|
||||||
},completion: { finished in
|
},completion: { finished in
|
||||||
widget.capturedTouches.removeAllObjects()
|
widget.capturedTouches.removeAllObjects()
|
||||||
@@ -3560,7 +3590,9 @@ import ObjectiveC.runtime
|
|||||||
widget.isHidden = folder.folded
|
widget.isHidden = folder.folded
|
||||||
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
if ((folder.buttonMode != .slideAndHold && widget.widgetType == .touchPad)
|
||||||
|| abs(widget.backgroundAlpha) < 0.1){
|
|| abs(widget.backgroundAlpha) < 0.1){
|
||||||
widget.highlightBorder(highlighted: false)
|
DispatchQueue.main.asyncAfter(deadline: .now() + (widget.widgetType == .touchPad ? 0.15 : 0)) {
|
||||||
|
widget.highlightBorder(highlighted: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if widget.hasNonEditableLabel {widget.setupAtrributedText()}
|
if widget.hasNonEditableLabel {widget.setupAtrributedText()}
|
||||||
})
|
})
|
||||||
|
|||||||
+13
-4
@@ -971,7 +971,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
|
|||||||
mouseDownButtonStack.isHidden = !widgetView.isMousePadWithButtonActions
|
mouseDownButtonStack.isHidden = !widgetView.isMousePadWithButtonActions
|
||||||
mouseButtonDownSelector.selectedSegmentIndex = Int(widgetView.mouseButtonAction.rawValue)
|
mouseButtonDownSelector.selectedSegmentIndex = Int(widgetView.mouseButtonAction.rawValue)
|
||||||
|
|
||||||
animatedStack.isHidden = !widgetView.isMagnifier
|
animatedStack.isHidden = !(widgetView.isMagnifier || widgetView.isFolder)
|
||||||
animatedSelector.selectedSegmentIndex = widgetView.animatesTransition ? 1 : 0
|
animatedSelector.selectedSegmentIndex = widgetView.animatesTransition ? 1 : 0
|
||||||
|
|
||||||
autoDockTimerStack.isHidden = !(widgetView.isFolder && widgetView.parentSequence == -1);
|
autoDockTimerStack.isHidden = !(widgetView.isFolder && widgetView.parentSequence == -1);
|
||||||
@@ -1722,11 +1722,15 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
|
|||||||
}
|
}
|
||||||
|
|
||||||
widgetSizeSlider.addTarget(self, action: #selector(widgetSizeSliderMoved(_:)), for: .valueChanged)
|
widgetSizeSlider.addTarget(self, action: #selector(widgetSizeSliderMoved(_:)), for: .valueChanged)
|
||||||
|
widgetSizeSlider.addTarget(self, action: #selector(widgetSizeSliderTouchUp(_:)), for: [.touchUpInside, .touchUpOutside])
|
||||||
widgetSizeLabel.text = LocalizationHelper.localizedString(forKey: "Size")
|
widgetSizeLabel.text = LocalizationHelper.localizedString(forKey: "Size")
|
||||||
widgetSizeStack.isHidden = true
|
widgetSizeStack.isHidden = true
|
||||||
|
|
||||||
widgetHeightSlider.addTarget(self, action: #selector(widgetHeightSliderMoved(_:)), for: .valueChanged)
|
widgetHeightSlider.addTarget(self, action: #selector(widgetHeightSliderMoved(_:)), for: .valueChanged)
|
||||||
|
widgetHeightSlider.addTarget(self, action: #selector(widgetSizeSliderTouchUp(_:)), for: [.touchUpInside, .touchUpOutside])
|
||||||
widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height")
|
widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height")
|
||||||
widgetHeightStack.isHidden = true
|
widgetHeightStack.isHidden = true
|
||||||
|
|
||||||
componentSizeSlider.addTarget(self, action: #selector(componentSizeSliderMoved(_:)), for: .valueChanged)
|
componentSizeSlider.addTarget(self, action: #selector(componentSizeSliderMoved(_:)), for: .valueChanged)
|
||||||
componentSizeLabel.text = LocalizationHelper.localizedString(forKey: "Component size")
|
componentSizeLabel.text = LocalizationHelper.localizedString(forKey: "Component size")
|
||||||
componentSizeStack.isHidden = true
|
componentSizeStack.isHidden = true
|
||||||
@@ -1922,12 +1926,19 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
|
|||||||
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
||||||
selectedWidgetView.widthFactor = CGFloat(sender.value)
|
selectedWidgetView.widthFactor = CGFloat(sender.value)
|
||||||
selectedWidgetView.heightFactor = CGFloat(sender.value)
|
selectedWidgetView.heightFactor = CGFloat(sender.value)
|
||||||
selectedWidgetView.resizeWidgetView()
|
|
||||||
}
|
}
|
||||||
if let selectedControllerLayer, controllerLayerSelected {
|
if let selectedControllerLayer, controllerLayerSelected {
|
||||||
layoutOSC.resizeControllerLayer(with: selectedControllerLayer, and: CGFloat(sender.value))
|
layoutOSC.resizeControllerLayer(with: selectedControllerLayer, and: CGFloat(sender.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func widgetSizeSliderTouchUp(_ sender: UISlider) {
|
||||||
|
if let selectedWidgetView, widgetViewSelected {
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||||
|
selectedWidgetView.isBeingResized = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc private func widgetHeightSliderMoved(_ sender: UISlider) {
|
@objc private func widgetHeightSliderMoved(_ sender: UISlider) {
|
||||||
widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height: %.2f", sender.value)
|
widgetHeightLabel.text = LocalizationHelper.localizedString(forKey: "Height: %.2f", sender.value)
|
||||||
@@ -1935,7 +1946,6 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
|
|||||||
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
||||||
if selectedWidgetView.shape == "round" { return }
|
if selectedWidgetView.shape == "round" { return }
|
||||||
selectedWidgetView.heightFactor = CGFloat(sender.value)
|
selectedWidgetView.heightFactor = CGFloat(sender.value)
|
||||||
selectedWidgetView.resizeWidgetView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1944,7 +1954,6 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
|
|||||||
if let selectedWidgetView, widgetViewSelected {
|
if let selectedWidgetView, widgetViewSelected {
|
||||||
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
selectedWidgetView.translatesAutoresizingMaskIntoConstraints = true
|
||||||
selectedWidgetView.componentSizeFactor = CGFloat(sender.value)
|
selectedWidgetView.componentSizeFactor = CGFloat(sender.value)
|
||||||
// selectedWidgetView.resizeWidgetView()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user