Skip to content

Commit 78ec46a

Browse files
V28: Introduce scroll inputs for LayerGroup (#114)
2 parents 24159af + ef6e2c0 commit 78ec46a

102 files changed

Lines changed: 6336 additions & 101 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Sources/StitchSchemaKit/SchemaVersions.swift

Lines changed: 100 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -9,105 +9,105 @@ import Foundation
99
import SwiftUI
1010

1111
// MARK: - UPDATE VERSION NUMBERS HERE
12-
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V27
13-
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V27
14-
public typealias CurrentCameraSettings = CameraSettings_V27
15-
public typealias CurrentCommentBoxData = CommentBoxData_V27
16-
public typealias CurrentCustomShape = CustomShape_V27
17-
public typealias CurrentDataType = DataType_V27
18-
public typealias CurrentDelayStyle = DelayStyle_V27
19-
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V27
20-
public typealias CurrentExpansionDirection = ExpansionDirection_V27
21-
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V27
22-
public typealias CurrentPatch = Patch_V27
23-
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V27
24-
public typealias CurrentLayerDimension = LayerDimension_V27
25-
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V27
26-
public typealias CurrentLayerNodeId = LayerNodeId_V27
27-
public typealias CurrentNodeEntity = NodeEntity_V27
28-
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V27
29-
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V27
30-
public typealias CurrentSplitterType = SplitterType_V27
31-
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V27
32-
public typealias CurrentJSONCurveTo = JSONCurveTo_V27
33-
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V27
34-
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V27
35-
public typealias CurrentSidebarLayerData = SidebarLayerData_V27
36-
public typealias CurrentNodeKind = NodeKind_V27
37-
public typealias CurrentAnchoring = Anchoring_V27
38-
public typealias CurrentCameraDirection = CameraDirection_V27
39-
public typealias CurrentLayer = Layer_V27
40-
public typealias CurrentLayerSize = LayerSize_V27
41-
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V27
42-
public typealias CurrentLayerStroke = LayerStroke_V27
43-
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V27
44-
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V27
45-
public typealias CurrentLightType = LightType_V27
46-
public typealias CurrentMediaKey = MediaKey_V27
47-
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V27
48-
public typealias CurrentNetworkRequestType = NetworkRequestType_V27
49-
public typealias CurrentPathPoint = PathPoint_V27
50-
public typealias CurrentPlane = Plane_V27
51-
public typealias CurrentPoint3D = Point3D_V27
52-
public typealias CurrentPoint4D = Point4D_V27
53-
public typealias CurrentPortValueComparable = PortValueComparable_V27
54-
public typealias CurrentPreviewSize = PreviewSize_V27
55-
public typealias CurrentRGBA = RGBA_V27
56-
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V27
57-
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V27
58-
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V27
59-
public typealias CurrentScrollMode = ScrollMode_V27
60-
public typealias CurrentShapeCommand = ShapeCommand_V27
61-
public typealias CurrentShapeCommandType = ShapeCommandType_V27
62-
public typealias CurrentShapeCoordinates = ShapeCoordinates_V27
63-
public typealias CurrentShapeAndRect = ShapeAndRect_V27
64-
public typealias CurrentStitchDocument = StitchDocument_V27
65-
public typealias CurrentStitchBlendMode = StitchBlendMode_V27
66-
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V27
67-
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V27
68-
public typealias CurrentStitchMapType = StitchMapType_V27
69-
public typealias CurrentStitchFont = StitchFont_V27
70-
public typealias CurrentStitchFontChoice = StitchFontChoice_V27
71-
public typealias CurrentStitchFontWeight = StitchFontWeight_V27
72-
public typealias CurrentStitchJSON = StitchJSON_V27
73-
public typealias CurrentStitchOrientation = StitchOrientation_V27
74-
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V27
75-
public typealias CurrentTextTransform = TextTransform_V27
76-
public typealias CurrentTriangleData = TriangleData_V27
77-
public typealias CurrentPortValue = PortValue_V27
78-
public typealias CurrentUserVisibleType = UserVisibleType_V27
79-
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V27
80-
public typealias CurrentNodeConnectionType = NodeConnectionType_V27
81-
public typealias CurrentLayerInputType = LayerInputType_V27
82-
public typealias CurrentNodeIOPortType = NodeIOPortType_V27
83-
public typealias CurrentStrokeLineCap = StrokeLineCap_V27
84-
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V27
85-
public typealias CurrentStitchStringValue = StitchStringValue_V27
86-
public typealias CurrentStitchContentMode = StitchContentMode_V27
87-
public typealias CurrentStitchSpacing = StitchSpacing_V27
88-
public typealias CurrentStitchPadding = StitchPadding_V27
89-
public typealias CurrentSizingScenario = SizingScenario_V27
90-
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V27
91-
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V27
92-
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V27
93-
public typealias CurrentCanvasItemId = CanvasItemId_V27
94-
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V27
95-
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V27
96-
public typealias CurrentPinToId = PinToId_V27
97-
public typealias CurrentLayerInputEntity = LayerInputEntity_V27
98-
public typealias CurrentLayerInputPort = LayerInputPort_V27
99-
public typealias CurrentLayerInputKeyPathType = LayerInputKeyPathType_V27
100-
public typealias CurrentUnpackedPortType = UnpackedPortType_V27
101-
public typealias CurrentStitchTransform = StitchTransform_V27
102-
public typealias CurrentStitchComponent = StitchComponent_V27
103-
public typealias CurrentComponentEntity = ComponentEntity_V27
104-
public typealias CurrentGraphEntity = GraphEntity_V27
105-
public typealias CurrentGraphSaveLocation = GraphSaveLocation_V27
106-
public typealias CurrentGraphDocumentPath = GraphDocumentPath_V27
107-
public typealias CurrentStitchSystemType = StitchSystemType_V27
108-
public typealias CurrentStitchSystem = StitchSystem_V27
109-
public typealias CurrentDeviceAppearance = DeviceAppearance_V27
110-
public typealias CurrentMaterialThickness = MaterialThickness_V27
12+
public typealias CurrentAsyncMediaValue = AsyncMediaValue_V28
13+
public typealias CurrentClassicAnimationCurve = ClassicAnimationCurve_V28
14+
public typealias CurrentCameraSettings = CameraSettings_V28
15+
public typealias CurrentCommentBoxData = CommentBoxData_V28
16+
public typealias CurrentCustomShape = CustomShape_V28
17+
public typealias CurrentDataType = DataType_V28
18+
public typealias CurrentDelayStyle = DelayStyle_V28
19+
public typealias CurrentDateAndTimeFormat = DateAndTimeFormat_V28
20+
public typealias CurrentExpansionDirection = ExpansionDirection_V28
21+
public typealias CurrentGroupNodeIDCoordinate = GroupNodeID_V28
22+
public typealias CurrentPatch = Patch_V28
23+
public typealias CurrentPatchNodeEntity = PatchNodeEntity_V28
24+
public typealias CurrentLayerDimension = LayerDimension_V28
25+
public typealias CurrentLayerNodeEntity = LayerNodeEntity_V28
26+
public typealias CurrentLayerNodeId = LayerNodeId_V28
27+
public typealias CurrentNodeEntity = NodeEntity_V28
28+
public typealias CurrentNodePortInputEntity = NodePortInputEntity_V28
29+
public typealias CurrentSplitterNodeEntity = SplitterNodeEntity_V28
30+
public typealias CurrentSplitterType = SplitterType_V28
31+
public typealias CurrentNodeIOCoordinate = NodeIOCoordinate_V28
32+
public typealias CurrentJSONCurveTo = JSONCurveTo_V28
33+
public typealias CurrentJSONShapeCommand = JSONShapeCommand_V28
34+
public typealias CurrentJSONShapeKeys = JSONShapeKeys_V28
35+
public typealias CurrentSidebarLayerData = SidebarLayerData_V28
36+
public typealias CurrentNodeKind = NodeKind_V28
37+
public typealias CurrentAnchoring = Anchoring_V28
38+
public typealias CurrentCameraDirection = CameraDirection_V28
39+
public typealias CurrentLayer = Layer_V28
40+
public typealias CurrentLayerSize = LayerSize_V28
41+
public typealias CurrentLayerTextDecoration = LayerTextDecoration_V28
42+
public typealias CurrentLayerStroke = LayerStroke_V28
43+
public typealias CurrentLayerTextAlignment = LayerTextAlignment_V28
44+
public typealias CurrentLayerTextVerticalAlignment = LayerTextVerticalAlignment_V28
45+
public typealias CurrentLightType = LightType_V28
46+
public typealias CurrentMediaKey = MediaKey_V28
47+
public typealias CurrentMobileHapticStyle = MobileHapticStyle_V28
48+
public typealias CurrentNetworkRequestType = NetworkRequestType_V28
49+
public typealias CurrentPathPoint = PathPoint_V28
50+
public typealias CurrentPlane = Plane_V28
51+
public typealias CurrentPoint3D = Point3D_V28
52+
public typealias CurrentPoint4D = Point4D_V28
53+
public typealias CurrentPortValueComparable = PortValueComparable_V28
54+
public typealias CurrentPreviewSize = PreviewSize_V28
55+
public typealias CurrentRGBA = RGBA_V28
56+
public typealias CurrentRoundedRectangleData = RoundedRectangleData_V28
57+
public typealias CurrentScrollDecelerationRate = ScrollDecelerationRate_V28
58+
public typealias CurrentScrollJumpStyle = ScrollJumpStyle_V28
59+
public typealias CurrentScrollMode = ScrollMode_V28
60+
public typealias CurrentShapeCommand = ShapeCommand_V28
61+
public typealias CurrentShapeCommandType = ShapeCommandType_V28
62+
public typealias CurrentShapeCoordinates = ShapeCoordinates_V28
63+
public typealias CurrentShapeAndRect = ShapeAndRect_V28
64+
public typealias CurrentStitchDocument = StitchDocument_V28
65+
public typealias CurrentStitchBlendMode = StitchBlendMode_V28
66+
public typealias CurrentStitchCameraOrientation = StitchCameraOrientation_V28
67+
public typealias CurrentStitchDeviceOrientation = StitchDeviceOrientation_V28
68+
public typealias CurrentStitchMapType = StitchMapType_V28
69+
public typealias CurrentStitchFont = StitchFont_V28
70+
public typealias CurrentStitchFontChoice = StitchFontChoice_V28
71+
public typealias CurrentStitchFontWeight = StitchFontWeight_V28
72+
public typealias CurrentStitchJSON = StitchJSON_V28
73+
public typealias CurrentStitchOrientation = StitchOrientation_V28
74+
public typealias CurrentStitchProgressIndicatorStyle = ProgressIndicatorStyle_V28
75+
public typealias CurrentTextTransform = TextTransform_V28
76+
public typealias CurrentTriangleData = TriangleData_V28
77+
public typealias CurrentPortValue = PortValue_V28
78+
public typealias CurrentUserVisibleType = UserVisibleType_V28
79+
public typealias CurrentVisualMediaFitStyle = VisualMediaFitStyle_V28
80+
public typealias CurrentNodeConnectionType = NodeConnectionType_V28
81+
public typealias CurrentLayerInputType = LayerInputType_V28
82+
public typealias CurrentNodeIOPortType = NodeIOPortType_V28
83+
public typealias CurrentStrokeLineCap = StrokeLineCap_V28
84+
public typealias CurrentStrokeLineJoin = StrokeLineJoin_V28
85+
public typealias CurrentStitchStringValue = StitchStringValue_V28
86+
public typealias CurrentStitchContentMode = StitchContentMode_V28
87+
public typealias CurrentStitchSpacing = StitchSpacing_V28
88+
public typealias CurrentStitchPadding = StitchPadding_V28
89+
public typealias CurrentSizingScenario = SizingScenario_V28
90+
public typealias CurrentNodeTypeEntity = NodeTypeEntity_V28
91+
public typealias CurrentCanvasNodeEntity = CanvasNodeEntity_V28
92+
public typealias CurrentLayerInputDataEntity = LayerInputDataEntity_V28
93+
public typealias CurrentCanvasItemId = CanvasItemId_V28
94+
public typealias CurrentLayerInputCoordinate = LayerInputCoordinate_V28
95+
public typealias CurrentLayerOutputCoordinate = LayerOutputCoordinate_V28
96+
public typealias CurrentPinToId = PinToId_V28
97+
public typealias CurrentLayerInputEntity = LayerInputEntity_V28
98+
public typealias CurrentLayerInputPort = LayerInputPort_V28
99+
public typealias CurrentLayerInputKeyPathType = LayerInputKeyPathType_V28
100+
public typealias CurrentUnpackedPortType = UnpackedPortType_V28
101+
public typealias CurrentStitchTransform = StitchTransform_V28
102+
public typealias CurrentStitchComponent = StitchComponent_V28
103+
public typealias CurrentComponentEntity = ComponentEntity_V28
104+
public typealias CurrentGraphEntity = GraphEntity_V28
105+
public typealias CurrentGraphSaveLocation = GraphSaveLocation_V28
106+
public typealias CurrentGraphDocumentPath = GraphDocumentPath_V28
107+
public typealias CurrentStitchSystemType = StitchSystemType_V28
108+
public typealias CurrentStitchSystem = StitchSystem_V28
109+
public typealias CurrentDeviceAppearance = DeviceAppearance_V28
110+
public typealias CurrentMaterialThickness = MaterialThickness_V28
111111

112112
// MARK: - end
113113

@@ -139,4 +139,5 @@ public enum StitchSchemaVersion: Int, VersionType {
139139
case _V25 = 25
140140
case _V26 = 26
141141
case _V27 = 27
142+
case _V28 = 28
142143
}

Sources/StitchSchemaKit/V1/NodePort/PortValue_V1.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public enum PortValue_V1: StitchSchemaVersionable {
6262
case networkRequestType(NetworkRequestType)
6363
case color(Color)
6464
case size(LayerSize)
65-
case position(CGSize) // TODO: use `CGPoint` instead of `CGSize`
65+
case position(CGSize)
6666
case point3D(Point3D)
6767
case point4D(Point4D)
6868
case pulse(TimeInterval) // TimeInterval = last time this input/output pulsed

Sources/StitchSchemaKit/V27/PortValueTypes/SidebarLayerData_V27.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ extension SidebarLayerData_V27.SidebarLayerData: StitchVersionedCodable {
4545
let migratedChildren: [Self] = .init(previousElements: prevChildren)
4646
self.init(id: previousInstance.id,
4747
children: migratedChildren,
48-
4948
// TODO: use previousInstance data after version 27
5049
isExpandedInSidebar: true)
5150
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
//
2+
// CommentBoxData_V28.swift
3+
//
4+
//
5+
// Created by Nicholas Arner on 1/27/24.
6+
//
7+
8+
import Foundation
9+
import SwiftUI
10+
11+
public enum CommentBoxData_V28: StitchSchemaVersionable {
12+
// MARK: - ensure versions are correct
13+
public static let version: StitchSchemaVersion = StitchSchemaVersion._V28
14+
public typealias PreviousInstance = CommentBoxData_V27.CommentBoxData
15+
public typealias CanvasItemId = CanvasItemId_V28.CanvasItemId
16+
// MARK: - endif
17+
18+
public struct CommentBoxData: Hashable {
19+
public var id: UUID
20+
21+
/*
22+
"Which traversal level (group node) does this comment box belong to?"
23+
24+
nil = top level
25+
26+
TODO: implement this properly, but wait until after SwiftData since e.g. VisibleNodesViewModel etc. may be changing.
27+
28+
For now we just make all comment boxes top-level.
29+
*/
30+
public var groupId: UUID?
31+
public var title: String = "Comment"
32+
public var color: Color
33+
public var nodes: Set<CanvasItemId>
34+
public var position: CGPoint
35+
public var size: CGSize
36+
public var zIndex: Double // = .zero
37+
38+
public init(id: CommentBoxId = .init(),
39+
groupId: UUID? = nil,
40+
title: String = "Comment",
41+
color: Color,
42+
nodes: Set<CanvasItemId> = .init(),
43+
position: CGPoint = .zero,
44+
size: CGSize,
45+
zIndex: Double) {
46+
self.id = id
47+
self.groupId = groupId
48+
self.title = title
49+
self.color = color
50+
self.nodes = nodes
51+
self.position = position
52+
self.size = size
53+
self.zIndex = zIndex
54+
}
55+
}
56+
}
57+
58+
extension CommentBoxData_V28.CommentBoxData: StitchVersionedCodable {
59+
public init(previousInstance: CommentBoxData_V28.PreviousInstance) {
60+
self.init(id: previousInstance.id,
61+
groupId: previousInstance.groupId,
62+
title: previousInstance.title,
63+
color: previousInstance.color,
64+
65+
// MARK: just needed for V23, should point to property in future versions
66+
nodes: .init(),
67+
68+
position: previousInstance.position,
69+
size: previousInstance.size,
70+
zIndex: previousInstance.zIndex)
71+
}
72+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Elliot Boschwitz on 8/17/24.
6+
//
7+
8+
import Foundation
9+
10+
public enum StitchComponent_V28: StitchSchemaVersionable {
11+
12+
// MARK: - ensure versions are correct
13+
public static let version = StitchSchemaVersion._V28
14+
public typealias PreviousInstance = StitchComponent_V27.StitchComponent
15+
public typealias GraphEntity = GraphEntity_V28.GraphEntity
16+
public typealias GraphSaveLocation = GraphSaveLocation_V28.GraphSaveLocation
17+
public typealias SidebarLayerList = [SidebarLayerData_V28.SidebarLayerData]
18+
// MARK: - end
19+
20+
public struct StitchComponent: StitchVersionedCodable, Hashable, Sendable {
21+
// Share location, saved here due to static helpers for sharing
22+
public var saveLocation: GraphSaveLocation
23+
public var graph: GraphEntity
24+
25+
public init(saveLocation: GraphSaveLocation,
26+
graph: GraphEntity) {
27+
self.saveLocation = saveLocation
28+
self.graph = graph
29+
}
30+
}
31+
}
32+
33+
extension StitchComponent_V28.StitchComponent {
34+
public init(previousInstance: StitchComponent_V28.PreviousInstance) {
35+
self = .init(saveLocation: .init(previousInstance: previousInstance.saveLocation),
36+
graph: .init(previousInstance: previousInstance.graph))
37+
}
38+
}

0 commit comments

Comments
 (0)