highlight border when moving on-screen widgets in layout tool
This commit is contained in:
1 parent
245f47f660
commit
32ad5d2f8a
1 file changed
+17
-1
@@ -1707,7 +1707,10 @@ import SVGKit
|
|||||||
let touch = touches.first
|
let touch = touches.first
|
||||||
// get touchBeganLocation
|
// get touchBeganLocation
|
||||||
|
|
||||||
if OnScreenWidgetView.editMode {self.touchBeganLocation = touch!.location(in: superview)}
|
if OnScreenWidgetView.editMode {
|
||||||
|
self.touchBeganLocation = touch!.location(in: superview)
|
||||||
|
self.highlightBorder(highlighted: true)
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if widgetType == WidgetTypeEnum.button, self.buttonMode == ButtonMode.movable.rawValue {self.touchBeganLocation = touch!.location(in: superview)}
|
if widgetType == WidgetTypeEnum.button, self.buttonMode == ButtonMode.movable.rawValue {self.touchBeganLocation = touch!.location(in: superview)}
|
||||||
else {self.touchBeganLocation = touch!.location(in: self)}
|
else {self.touchBeganLocation = touch!.location(in: self)}
|
||||||
@@ -2465,6 +2468,8 @@ import SVGKit
|
|||||||
// Trigger layout update
|
// Trigger layout update
|
||||||
superview.layoutIfNeeded()
|
superview.layoutIfNeeded()
|
||||||
|
|
||||||
|
self.highlightBorder(highlighted: false)
|
||||||
|
|
||||||
setupView(); //re-setup widgetView style
|
setupView(); //re-setup widgetView style
|
||||||
|
|
||||||
if self.widgetType == WidgetTypeEnum.touchPad{
|
if self.widgetType == WidgetTypeEnum.touchPad{
|
||||||
@@ -2551,6 +2556,17 @@ import SVGKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func highlightBorder(highlighted:Bool) {
|
||||||
|
if highlighted {
|
||||||
|
self.layer.borderWidth = 2
|
||||||
|
self.layer.borderColor = voidlinkPurple
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.layer.borderWidth = self.borderWidth
|
||||||
|
self.layer.borderColor = self.defaultBorderColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func didMoveToSuperview() {
|
override func didMoveToSuperview() {
|
||||||
super.didMoveToSuperview()
|
super.didMoveToSuperview()
|
||||||
if superview == nil {
|
if superview == nil {
|
||||||
|
|||||||
Reference in new issue
Block a user