-
Notifications
You must be signed in to change notification settings - Fork 59
Fix RendererLeafView.makeLeafView(view:inputs:) #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| // Status: WIP | ||
|
|
||
| package import Foundation | ||
| import OpenAttributeGraphShims | ||
| package import OpenAttributeGraphShims | ||
|
|
||
| // MARK: - RendererLeafView [TODO] | ||
|
|
||
|
|
@@ -26,24 +26,76 @@ extension RendererLeafView { | |
| } | ||
|
|
||
| package static func makeLeafView(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs { | ||
| // TODO | ||
| var outputs = _ViewOutputs() | ||
| // FIXME | ||
| outputs.preferences.displayList = Attribute( | ||
| LeafDisplayList( | ||
| identity: .init(), | ||
| view: view.value, | ||
| position: inputs.animatedPosition(), | ||
| size: inputs.animatedCGSize(), | ||
| containerPosition: inputs.containerPosition, | ||
| options: .defaultValue, | ||
| contentSeed: .init() | ||
|
|
||
| if inputs.preferences.requiresDisplayList { | ||
| let identity = DisplayList.Identity() | ||
| inputs.pushIdentity(identity) | ||
|
|
||
| outputs.preferences.displayList = Attribute( | ||
| LeafDisplayList( | ||
| identity: identity, | ||
| view: view.value, | ||
| position: inputs.animatedPosition(), | ||
| size: inputs.animatedCGSize(), | ||
| containerPosition: inputs.containerPosition, | ||
| options: inputs.displayListOptions, | ||
| contentSeed: DisplayList.Seed() | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
| if inputs.preferences.requiresViewResponders { | ||
| outputs.preferences.viewResponders = Attribute( | ||
| LeafResponderFilter( | ||
| data: view.value, | ||
| size: inputs.animatedSize(), | ||
| position: inputs.animatedPosition(), | ||
| transform: inputs.transform | ||
| ) | ||
| ) | ||
| } | ||
|
Comment on lines
+48
to
+57
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gesture and ViewResponder system is not ready yet. And this PR does not implement them either. |
||
|
|
||
| // TODO | ||
| // outputs.makeContentPathPreferenceWriter( | ||
| // inputs: inputs, | ||
| // contentResponder: view.value | ||
| // ) | ||
|
|
||
| return outputs | ||
| } | ||
| } | ||
|
|
||
| package struct LeafResponderFilter<Data>: StatefulRule { | ||
| @Attribute private var data: Data | ||
| @Attribute private var size: ViewSize | ||
| @Attribute private var position: CGPoint | ||
| @Attribute private var transform: ViewTransform | ||
| package private(set) lazy var responder = LeafViewResponder<Data>() | ||
|
|
||
| package init( | ||
| data: Attribute<Data>, | ||
| size: Attribute<ViewSize>, | ||
| position: Attribute<CGPoint>, | ||
| transform: Attribute<ViewTransform> | ||
| ) { | ||
| self._data = data | ||
| self._size = size | ||
| self._position = position | ||
| self._transform = transform | ||
| } | ||
|
|
||
| package typealias Value = [ViewResponder] | ||
|
|
||
| package func updateValue() { | ||
| _openSwiftUIUnimplementedWarning() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll implement and test it when Gesture is ready. Looks like currently we do not need those. |
||
| } | ||
| } | ||
|
|
||
| package final class LeafViewResponder<Data>: ViewResponder { | ||
| // TODO | ||
| } | ||
|
|
||
| // MARK: - LeafViewLayout | ||
|
|
||
| package protocol LeafViewLayout { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed on ViewHidden. And I have fixed in #612