[Feature] Interactive Liquid Glass: a view's glass that answers its presses (effectIsInteractive, isInteractive)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 22/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go, macos, objective-c
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Go
- スター
- 684
- フォーク
- 41
- 平均マージ
- 8時間 8分
- マージ済み PR(30日)
- 911
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nsgo-dev/nsgo のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
macos: TestInputMethodCommitAndSinkCandidates times out waiting for focus after other window tests対応中かも @houko が今日担当しました。 オープン
nsgo-dev/nsgo#2157 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
linux: a fitted panel realized before its first fit keeps its options size対応中かも @houko が今日担当しました。 オープン
nsgo-dev/nsgo#2096 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
base: Radio has no LabelFunc or HintFunc, unlike Checkbox and Button対応中かも @houko が今日担当しました。 オープン
nsgo-dev/nsgo#2059 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
apple: TestWebMuteSuspendsMedia aborts the test process removing observers it never added対応中かも @oneo-me が今日担当しました。 オープン
nsgo-dev/nsgo#2053 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
DaoCloud/DaoCloud-docs#7839 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
projectdiscovery/urlfinder#167 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
peterstace/simplefeatures#726 ·
-
area: import bug go good first issue priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fukubie/StockLlama#69 ·
-
enhancement help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
cloverworks-hq/rumpty-cli#95 ·
メンテナーはふだん 1 日以内に返信