This commit is contained in:
kornerr committed 2026-11-10 13:04:09 +03:00
1 parent aacd44d84b
commit 1d1f92e923
5 files changed
+16 -16

No files matched your search

@@ -33,7 +33,7 @@ final class RenderGLView: NSOpenGLView {
width: Double(ps[0]),
height: Double(ps[1])
) {
selectionSet(F.selectedQuadId, id)
selectionSet(F.selectedItemId, id)
}
}
+3 -3
View File
@@ -962,7 +962,7 @@ hello/hello-selection/dialect.yml contains SelectionContext/SelectionComponent
and the established Render definitions. Its only output is ver-mac/src/dialect.swift;
Kotlin generation is intentionally deferred until Android support is added.
Selection setup emits launch once, initializing title. Mouse input dispatches
selectedQuadId, whose rule converts the ID to title; the title effect updates
selectedItemId, whose rule converts the ID to title; the title effect updates
SelectionVM.shared. Repeated setup preserves the current selection title.
No handwritten click handler assigns authoritative state or changes the VM title.
@@ -996,9 +996,9 @@ Geometry uses top-left-origin backing pixels. macOS mouseDown first converts
the window event into local view coordinates, then converts to backing pixels.
It subtracts the backing bounds' minimum X and flips Y using their maximum Y.
The viewport size comes from the same renderPixelSize helper used by resize.
Only a hit emits selectedQuadId; a miss emits no event.
Only a hit emits selectedItemId; a miss emits no event.
For another platform, keep this layout, ID order, selectedQuadId/title rules and
For another platform, keep this layout, ID order, selectedItemId/title rules and
event-driven model update. Adapt only native input conversion and graphics
integration. Do not copy macOS's Y flip or scale conversion to an API that
already reports top-left physical pixels, and do not invent preparation guards.
+3 -3
View File
@@ -9,7 +9,7 @@ SelectionContext:
fields:
didLaunch: Bool
didSetup: Bool
selectedQuadId: Int
selectedItemId: Int
title: String
SelectionComponent:
@@ -31,9 +31,9 @@ SelectionComponent:
c.title = "hello-selection"
2. Upon selecting a quad:
if:
c.recentField == F.selectedQuadId
c.recentField == F.selectedItemId
then:
c.title = String(c.selectedQuadId)
c.title = String(c.selectedItemId)
RenderContext:
type: context
@@ -130,7 +130,7 @@ public struct F {
public static let didSetup = "didSetup"
public static let pixelSize = "pixelSize"
public static let reshapePixelSize = "reshapePixelSize"
public static let selectedQuadId = "selectedQuadId"
public static let selectedItemId = "selectedItemId"
public static let title = "title"
public static let willDeinit = "willDeinit"
public static let willRecreateSurface = "willRecreateSurface"
@@ -247,7 +247,7 @@ public struct RenderContext: DialectContext {
public struct SelectionContext: DialectContext {
public var didLaunch = Bool()
public var didSetup = Bool()
public var selectedQuadId = Int()
public var selectedItemId = Int()
public var title = String()
public var recentField = ""
@@ -259,8 +259,8 @@ public struct SelectionContext: DialectContext {
else if (name == "didSetup") {
return didSetup as! T
}
else if (name == "selectedQuadId") {
return selectedQuadId as! T
else if (name == "selectedItemId") {
return selectedItemId as! T
}
else if (name == "title") {
return title as! T
@@ -279,8 +279,8 @@ public struct SelectionContext: DialectContext {
else if (name == "didSetup") {
didSetup = value as! Bool
}
else if (name == "selectedQuadId") {
selectedQuadId = value as! Int
else if (name == "selectedItemId") {
selectedItemId = value as! Int
}
else if (name == "title") {
title = value as! String
@@ -458,9 +458,9 @@ func selectionShouldResetTitle(_ c: SelectionContext) -> SelectionContext {
/* 2. Upon selecting a quad */
if
c.recentField == F.selectedQuadId
c.recentField == F.selectedItemId
{
c.title = String(c.selectedQuadId)
c.title = String(c.selectedItemId)
c.recentField = F.title
return c
}
@@ -28,7 +28,7 @@ final class SelectionTests: XCTestCase {
component.setup()
XCTAssertEqual(vm.title, "hello-selection")
for id in [1, 2, 3, 4, 4, 1] {
selectionSet(F.selectedQuadId, id)
selectionSet(F.selectedItemId, id)
XCTAssertEqual(vm.title, String(id))
}
component.setup()