[Feature] Interactive Liquid Glass: a view's glass that answers its presses (effectIsInteractive, isInteractive)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 22/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go, macos, objective-c
Direzione di ricerca
Start with setBackdrop in internal/platform/macos/material.go, where the NSGlassEffectView gets its content view, and with hitTest in internal/platform/macos/macos.go (around lines 2457 and 2475) and the classOverlay hitTest: at line 566, which decide who receives presses. Done means a press on a glass-styled pressable view swells the glass and its OnPress still fires, with a native test covering the hit-view routing. The maintainer's three shape questions (boolean style, macOS-first scope, container children) need answers before implementation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What you want to do / 想做什么
A button of Liquid Glass in an NSGo app stays still under a press, where the system's own controls of glass answer it. I would like a style that turns the system's answer on, for example Style.GlassInteractive bool beside GlassEffect (glassInteractive in TSX).
What the platforms have
- macOS 27:
NSGlassEffectView.effectIsInteractive(API_AVAILABLE(macos(27.0))): "should be enabled for glass that is used as the background for interactive controls or when used as the container of interactive controls". - iOS 26:
UIGlassEffect.isInteractive. - Windows draws glass with NSGo's shader and the web a blur, so there is nothing to turn on there.
Why setting the property is not enough on macOS (main at a8284d7b)
setBackdrop(internal/platform/macos/material.go:175) puts theNSGlassEffectViewunder the view's children (line 208) and gives itglassContent, the border host, as its content view (line 220).- AppKit answers a press through a gesture recognizer on a private view inside the glass that holds the content view (
NSGlassEffectView.ContentHolderView, an_NSComponentGestureRecognizerof SwiftUI'sFlexInteraction). So it answers only when the view the press hits is the content view or a view inside it. - Measured on macOS 27.2.1 with raw AppKit views and the property set, by sampling the glass's presentation layers: a press on the bare glass, on a label in its content view, or on an
NSButtonin its content view scales the glass up by about 2.5 pt of width whatever its size (1.003× at 720 pt, 1.015× at 150 pt, 1.07× at 34 pt) and holds it there; on release it springs back while a second layer grows from 1.2× to 4× in about 0.6 s, which I take for the highlight. A press on a sibling view above the glass changes nothing. - NSGo's hit test returns the pressable view's own native view (
hitTest,internal/platform/macos/macos.go:2457,return nat 2475), which is the glass's superview, andglassContentis aclassOverlay, whosehitTest:returns nil (macos.go:566). With the property set, no press reaches the glass.
What worked in a fork, macOS only
On v0.2.0 plus a patch, on macOS 27.2.1:
- The hit test returns the glass's content view for the presses the glass's own view takes (
return nbecomes that content view while the view's glass is interactive). AppKit sends the mouse events there, the content view handles none, so they go up the responder chain to the view's native view andmouseDownandmouseUprun as before. The content view answersacceptsFirstMouse:with true andmouseDownCanMoveWindowwith false, as NSGo's views do. - A pressable view of glass then swells under the press and springs back, and its
OnPressstill fires. A native test covers the routing: the view hit is inside the glass's content view, its responder chain reaches the view, a pressable child keeps its own press, and turning the style off or taking the glass away gives the old hit view back. On main the border host is already there to take the presses. - The limit: a press a child takes, such as a button or a text field inside a container of glass, does not reach the glass, since NSGo's children are beside it. I tried making the holder of a view's children the content view. Every press was answered, but a multiline
Inputinside drew its caret 6 pt low, so I dropped it. - AppKit's answer is slight. Messages, a Catalyst app on UIKit's glass, swells far more under a press, so what the other targets imitate is a choice too.
Questions
- Is a boolean beside
GlassEffectthe shape you want? - Should it wait for iOS, where the backdrop has
setUserInteractionEnabled:false(internal/platform/ios/content.go:208) and touches need a way to the effect view, and for Windows' shader to imitate the swell, or can macOS go first with the rest in the roadmap? - Is "the presses the view takes itself" enough for a container, or should its children go inside the content view?
I can send the macOS part as a pull request once the shape is settled.
Target platforms / 目标平台
macOS, iOS
App language / 应用语言
Go
Latest version / 最新版本
- I have checked that the latest NSGo release still lacks it. / 我已确认最新版 NSGo 仍不支持。
NSGo version / NSGo 版本
github.com/nsgo-dev/nsgo v0.2.0
Development machine / 开发环境
Arch Linux x86_64, Go 1.27.4, cross-building the macOS app; native tests on macOS 27.2.1 (Apple M3), Go 1.27.3, Command Line Tools 27.2
Target devices / 运行设备
Mac (Apple M3), macOS 27.2.1
- Lingua principale
- Go
- Stelle
- 684
- Fork
- 41
- Merge medio
- 8h 8m
- PR unite (30g)
- 911
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nsgo-dev/nsgo
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
macos: TestInputMethodCommitAndSinkCandidates times out waiting for focus after other window testsForse già presa @houko l’ha presa oggi. Aperta
nsgo-dev/nsgo#2157 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
linux: a fitted panel realized before its first fit keeps its options sizeForse già presa @houko l’ha presa oggi. Aperta
nsgo-dev/nsgo#2096 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
base: Radio has no LabelFunc or HintFunc, unlike Checkbox and ButtonForse già presa @houko l’ha presa oggi. Aperta
nsgo-dev/nsgo#2059 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
apple: TestWebMuteSuspendsMedia aborts the test process removing observers it never addedForse già presa @oneo-me l’ha presa oggi. Aperta
nsgo-dev/nsgo#2053 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di nsgo-dev/nsgo
Issue simili
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaudeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
go good first issue test
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
bug github_actions good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
libr-forum/libr#77 ·
I maintainer di solito rispondono entro 1 giorno
-
[UI] Guard webApis against undefined window in SSR environmentsForse già presa @madhavzanwar l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
kind/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno