M6 elements and window: Element/Render/views, headless Window, div, canvas
- input: mouse events, modifiers, dispatch phases. - window: Element / AnyElement / IntoElement, Render / AnyView (entities render as elements), listener(), empty(); Window with the draw cycle (render, layout to fill the viewport, prepaint, paint, finish) and phase checks; content-mask / element-offset / opacity / element-id stacks; element state across frames (ElementStateKey); hitboxes, hit testing, occlusion; mouse dispatch (capture + bubble, stop_propagation); hover- and notify-driven invalidation of rendered views; painting: paint_quad with device-pixel snapping, drop/inset shadows, paint_path, paint_style (port of Style::paint). - elements: div() (Styled, children, hover, mouse down/up/move/scroll, clicks with element state, occlude, overflow clipping, opacity) and canvas(); Styled extend lists generated by tools/gen_style.py. - app: observe_notifications hook used by windows. - Tests: end-to-end views -> scene, clicks, hover, invalidation, nested views, bubbling, occlusion, shadows/borders/clipping, canvas, resize, and aborts on misuse. The card example now renders a real view and simulates hover and click. - Docs: PORTING.md M6 status and deviations; README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eeab51348e
commit
fbe4c081e6
24 files changed
+15532
-204
No files matched your search
@@ -0,0 +1,99 @@
|
||||
// Generated using `moon info`, DON'T EDIT IT
|
||||
package "experiments/gpui/input"
|
||||
|
||||
import {
|
||||
"experiments/gpui/geometry",
|
||||
"moonbitlang/core/debug",
|
||||
}
|
||||
|
||||
// Values
|
||||
|
||||
// Errors
|
||||
|
||||
// Types and methods
|
||||
#derive(Default, Eq, @debug.Debug)
|
||||
pub(all) struct ClickEvent {
|
||||
down : MouseDownEvent
|
||||
up : MouseUpEvent
|
||||
}
|
||||
|
||||
#derive(Eq, Hash, @debug.Debug)
|
||||
pub(all) enum DispatchPhase {
|
||||
Capture
|
||||
Bubble
|
||||
}
|
||||
|
||||
#derive(Default, Eq, Hash, @debug.Debug)
|
||||
pub(all) struct Modifiers {
|
||||
control : Bool
|
||||
alt : Bool
|
||||
shift : Bool
|
||||
platform : Bool
|
||||
function : Bool
|
||||
}
|
||||
pub fn Modifiers::modified(Self) -> Bool
|
||||
|
||||
#derive(Eq, Hash, @debug.Debug)
|
||||
pub(all) enum MouseButton {
|
||||
Left
|
||||
Right
|
||||
Middle
|
||||
Navigate(NavigationDirection)
|
||||
}
|
||||
pub impl Default for MouseButton
|
||||
|
||||
#derive(Default, Eq, @debug.Debug)
|
||||
pub(all) struct MouseDownEvent {
|
||||
button : MouseButton
|
||||
position : @geometry.Point[@geometry.Pixels]
|
||||
modifiers : Modifiers
|
||||
click_count : Int32
|
||||
first_mouse : Bool
|
||||
}
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum MouseEvent {
|
||||
MouseDown(MouseDownEvent)
|
||||
MouseUp(MouseUpEvent)
|
||||
MouseMove(MouseMoveEvent)
|
||||
ScrollWheel(ScrollWheelEvent)
|
||||
}
|
||||
pub fn MouseEvent::position(Self) -> @geometry.Point[@geometry.Pixels]
|
||||
|
||||
#derive(Default, Eq, @debug.Debug)
|
||||
pub(all) struct MouseMoveEvent {
|
||||
position : @geometry.Point[@geometry.Pixels]
|
||||
pressed_button : MouseButton?
|
||||
modifiers : Modifiers
|
||||
}
|
||||
|
||||
#derive(Default, Eq, @debug.Debug)
|
||||
pub(all) struct MouseUpEvent {
|
||||
button : MouseButton
|
||||
position : @geometry.Point[@geometry.Pixels]
|
||||
modifiers : Modifiers
|
||||
click_count : Int32
|
||||
}
|
||||
|
||||
#derive(Eq, Hash, @debug.Debug)
|
||||
pub(all) enum NavigationDirection {
|
||||
Back
|
||||
Forward
|
||||
}
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum ScrollDelta {
|
||||
Pixels(@geometry.Point[@geometry.Pixels])
|
||||
Lines(@geometry.Point[Double])
|
||||
}
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct ScrollWheelEvent {
|
||||
position : @geometry.Point[@geometry.Pixels]
|
||||
delta : ScrollDelta
|
||||
modifiers : Modifiers
|
||||
}
|
||||
|
||||
// Type aliases
|
||||
|
||||
// Traits
|
||||
Reference in new issue
Block a user