Skip to content

Commit

Permalink
Fix MultitouchExtension/IgnoredAreaView.swift corruption in macOS 11
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Dec 7, 2023
1 parent 4070a4c commit 065b373
Showing 1 changed file with 49 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,42 +56,40 @@ struct IgnoredAreaView: View {
.frame(width: areaWidth, height: areaHeight)
.padding(.leading, areaLeading)
.padding(.top, areaTop)
.overlay(
Group {
Path { path in
path.addLines([
CGPoint(x: areaX50, y: areaTop),
CGPoint(x: areaX50, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY50),
CGPoint(x: areaLeading + areaWidth, y: areaY50),
])
}.stroke(.black, lineWidth: 1)

Path { path in
path.addLines([
CGPoint(x: areaX25, y: areaTop),
CGPoint(x: areaX25, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaX75, y: areaTop),
CGPoint(x: areaX75, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY25),
CGPoint(x: areaLeading + areaWidth, y: areaY25),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY75),
CGPoint(x: areaLeading + areaWidth, y: areaY75),
])
}.stroke(.black, style: StrokeStyle(lineWidth: 1, dash: [2]))
})

Path { path in
path.addLines([
CGPoint(x: areaX50, y: areaTop),
CGPoint(x: areaX50, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY50),
CGPoint(x: areaLeading + areaWidth, y: areaY50),
])
}.stroke(.black, lineWidth: 1)

Path { path in
path.addLines([
CGPoint(x: areaX25, y: areaTop),
CGPoint(x: areaX25, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaX75, y: areaTop),
CGPoint(x: areaX75, y: areaTop + areaHeight),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY25),
CGPoint(x: areaLeading + areaWidth, y: areaY25),
])

path.addLines([
CGPoint(x: areaLeading, y: areaY75),
CGPoint(x: areaLeading + areaWidth, y: areaY75),
])
}.stroke(.black, style: StrokeStyle(lineWidth: 1, dash: [2]))

ForEach(fingerManager.states) { state in
if state.touchedPhysically || state.touchedFixed || state.palmed {
Expand All @@ -107,28 +105,31 @@ struct IgnoredAreaView: View {
if state.touchedFixed {
Circle()
.fill(color)
.frame(width: diameter)
.frame(width: diameter, height: diameter)
.padding(.leading, leading)
.padding(.top, top)
}

let palmThresholdLeading = areaSize.width * state.point.x - (thresholdDiameter / 2)
let palmThresholdTop =
areaSize.height * (1.0 - state.point.y) - (thresholdDiameter / 2)
VStack {
Circle()
.stroke(
!state.touchedFixed ? Color.black : (state.palmed ? Color.gray : palmedColor),
style: StrokeStyle(lineWidth: 2)
)
.frame(width: thresholdDiameter)
Text("\(String(format: "%.1f", state.size))")
}
.padding(.leading, palmThresholdLeading)
.padding(.top, palmThresholdTop)

Circle()
.stroke(
!state.touchedFixed ? Color.black : (state.palmed ? Color.gray : palmedColor),
style: StrokeStyle(lineWidth: 2)
)
.frame(width: thresholdDiameter, height: thresholdDiameter)
.padding(.leading, palmThresholdLeading)
.padding(.top, palmThresholdTop)

Text("\(String(format: "%.1f", state.size))")
.padding(.leading, palmThresholdLeading)
.padding(.top, palmThresholdTop + thresholdDiameter)
}
}
}
.frame(width: areaSize.width, height: areaSize.height)

VStack {
Text("Ignored")
Expand Down

0 comments on commit 065b373

Please sign in to comment.