scui
This commit is contained in:
1 parent
4d6b89a6b5
commit
0bdff9d99f
5 files changed
+17
-13
No files matched your search
@@ -119,6 +119,7 @@
|
||||
| hrb | √ | √ | √ | √ | √ | **H**ello **R**ayli**b** is a simple Raylib rendering to validate platform support | |
|
||||
| hst | √ | √ | √ | √ | ? | **H**ello **s**elec**t**ion validates mouse clicks and taps into Raylib scene | |
|
||||
| raybri | √ | √ | √ | √ | √ | **Ray**lib **bri**dge is a collection of Raylib calls grouped for convenience | N/A |
|
||||
| scui | X | X | √ | X | ? | **S**wift **C**ross **UI** related functions to make it closer to SwiftUI | N/A |
|
||||
|
||||
[angle-zip]: https://github.com/google/angle/archive/ea1cea778c4a2312ef1b963b29a62fe595dd4df8.zip
|
||||
[raylib-zip]: https://github.com/raysan5/raylib/archive/refs/tags/6.2.zip
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import CGtk
|
||||
import GtkBackend
|
||||
import SwiftCrossUI
|
||||
|
||||
public extension View {
|
||||
func allowsHitTesting(_ enabled: Bool) -> some View {
|
||||
inspect(.onCreate) { widget in
|
||||
// Apply hit testing to the GTK wrapper created by inspect
|
||||
gtk_widget_set_can_target(widget.parentWidget!.widgetPointer, enabled ? 1 : 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1196,9 +1196,9 @@ macOS loader.
|
||||
GTK's click gesture reports the primary press in local logical coordinates.
|
||||
RenderGLView converts Y to a bottom-left origin and publishes `mouseDownPos`.
|
||||
The shared Render and HST rules handle scene conversion and selection.
|
||||
`HSTView` declares the title in SwiftCrossUI. The Linux `HSTApp` applies its
|
||||
file-local `allowsHitTesting(false)` modifier to `HSTView`. The modifier uses
|
||||
GTK inspection to make the title's wrapper pass pointer events through to the GL area.
|
||||
`HSTView` declares the title in SwiftCrossUI. The Linux `HSTApp` applies
|
||||
`allowsHitTesting(false)` from the `scui` component to `HSTView`. The modifier
|
||||
uses GTK inspection to let pointer events pass through the title's wrapper.
|
||||
|
||||
From hello-selection, with the same Linux prerequisites as hello-raylib:
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import CGtk
|
||||
import GtkBackend
|
||||
import SwiftCrossUI
|
||||
|
||||
@@ -20,12 +19,3 @@ struct HSTApp: App {
|
||||
.defaultSize(width: 640, height: 480)
|
||||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
func allowsHitTesting(_ enabled: Bool) -> some View {
|
||||
inspect(.onCreate) { widget in
|
||||
// Apply hit testing to the GTK wrapper created by inspect
|
||||
gtk_widget_set_can_target(widget.parentWidget!.widgetPointer, enabled ? 1 : 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../../../../../components/scui/linux/scuiAllowsHitTesting.swift
|
||||
Reference in new issue
Block a user