载入中...
搜索中...
未找到
UiPreview.cpp
浏览该文件的文档.
10UiPreviewSnapshot UiDocumentPreviewService::build(const UiDocumentTarget& document, double width, double height) const {
30 const double parentWidth = std::max(0.0, parent.width - widget.style.marginLeft - widget.style.marginRight);
31 const double parentHeight = std::max(0.0, parent.height - widget.style.marginTop - widget.style.marginBottom);
39 contentX + parentWidth * widget.layout.anchorX + widget.layout.x - preview.width * widget.layout.pivotX;
41 contentY + parentHeight * widget.layout.anchorY + widget.layout.y - preview.height * widget.layout.pivotY;
48 childParent.width = std::max(0.0, childParent.width - widget.style.paddingLeft - widget.style.paddingRight);
49 childParent.height = std::max(0.0, childParent.height - widget.style.paddingTop - widget.style.paddingBottom);
56 [](const EditorDiagnostic& diagnostic) { return diagnostic.severity() == DiagnosticSeverity::Error; });
61Result<ObjectId> UiDocumentPreviewService::pick(const UiPreviewSnapshot& preview, double x, double y) const {
63 return eve::editing::failed<ObjectId>(EditorStatus::Rejected, RuleId("editor.ui.invalid-pick-point"),
83 return eve::editing::failed<EditorValue>(EditorStatus::Conflict, RuleId("editor.ui.stale-preview"),
87 return eve::editing::failed<EditorValue>(EditorStatus::NotFound, RuleId("editor.ui.widget-not-found"),
89 double parentX = 0.0, parentY = 0.0, parentW = preview.viewportWidth, parentH = preview.viewportHeight;
102 0.0, parent->width - parentWidget.value().style.paddingLeft - parentWidget.value().style.paddingRight);
104 0.0, parent->height - parentWidget.value().style.paddingTop - parentWidget.value().style.paddingBottom);
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
Result< EditorValue > anchorGizmo(const UiDocumentTarget &document, const UiPreviewSnapshot &preview, const ObjectId &widget) const
Return anchor point, pivot point and connecting line as numeric pairs.
Definition UiPreview.cpp:79
UiPreviewSnapshot build(const UiDocumentTarget &document, double width, double height) const
Compute absolute rectangles for a viewport without mutating runtime UI.
Definition UiPreview.cpp:10
Result< ObjectId > pick(const UiPreviewSnapshot &preview, double x, double y) const
Pick the deepest visible widget under a preview-space point.
Definition UiPreview.cpp:61
Serializable UI authoring document with hierarchy and inspector capabilities.
Definition UiDocument.h:149
std::vector< EditorDiagnostic > validate() const
Validate style, hierarchy and viewport layout constraints.
Definition UiDocument.cpp:272
std::vector< ObjectId > children(const ObjectId &parent) const override
Children.
Definition UiDocument.cpp:127
Result< UiWidgetSnapshot > widget(const ObjectId &id) const override
Widget.
Definition UiDocument.cpp:119
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build a common diagnostic carrying an open editing rule identity.
Definition EditingResult.h:25
Definition UiDocument.cpp:9
@ InvalidArgument
Deterministic UI layout preview used by canvas rendering and picking.
Definition UiDocument.h:246
std::vector< UiPreviewWidget > widgets
Definition UiDocument.h:250
std::vector< EditorDiagnostic > diagnostics
Definition UiDocument.h:251
Revision documentRevision
Definition UiDocument.h:248
Computed widget rectangle in a revision-bound UI preview.
Definition UiDocument.h:237
Immutable widget snapshot used across editor/runtime boundaries.
Definition UiDocument.h:94