Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Feature/element styling state aware#62
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
cf879de6a160e9e1c3f8f945131e9812abbe4f6c1c70210e957f5e5147b1c53a527808File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -23,9 +23,8 @@ struct BorderStyle { | ||||||||||||||||||
| float thickness = 0; | ||||||||||||||||||
| }; | ||||||||||||||||||
| BorderStyle extractBorderStyle(const json& borderStyleDef); | ||||||||||||||||||
| struct BaseDrawStyle { | ||||||||||||||||||
| struct ElementStyleParts { | ||||||||||||||||||
| json styleDef; | ||||||||||||||||||
| std::optional<ImVec4> backgroundColor; | ||||||||||||||||||
| std::optional<BorderStyle> borderTop; | ||||||||||||||||||
| std::optional<BorderStyle> borderRight; | ||||||||||||||||||
| @@ -36,6 +35,16 @@ struct BaseDrawStyle { | ||||||||||||||||||
| ImDrawFlags drawFlags = ImDrawFlags_RoundCornersNone; | ||||||||||||||||||
| }; | ||||||||||||||||||
| struct ElementStyle { | ||||||||||||||||||
| std::optional<ElementStyleParts> maybeBase; | ||||||||||||||||||
| std::optional<ElementStyleParts> maybeDisabled; | ||||||||||||||||||
| std::optional<ElementStyleParts> maybeHover; | ||||||||||||||||||
| std::optional<ElementStyleParts> maybeActive; | ||||||||||||||||||
| }; | ||||||||||||||||||
| BorderStyle extractBorderStyle(const json& borderStyleDef); | ||||||||||||||||||
| ElementStyleParts extractStyleParts(const json& styleDef); | ||||||||||||||||||
| class Element { | ||||||||||||||||||
| public: | ||||||||||||||||||
| int m_id; | ||||||||||||||||||
| @@ -44,11 +53,14 @@ class Element { | ||||||||||||||||||
| bool m_handlesChildrenWithinRenderMethod; | ||||||||||||||||||
| bool m_isRoot; | ||||||||||||||||||
| bool m_cull; | ||||||||||||||||||
| bool m_hovered; | ||||||||||||||||||
| bool m_isHovered = false; | ||||||||||||||||||
| bool m_isActive = false; | ||||||||||||||||||
| bool m_isFocused = false; | ||||||||||||||||||
| bool m_trackMouseClickEvents = false; | ||||||||||||||||||
Comment on lines
+56
to
+59
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. 🧹 Nitpick (assertive) Ensure Consistent Naming Convention The member variables Apply the following diff to maintain consistent naming: - bool m_trackMouseClickEvents = false;+ bool m_isTrackingMouseClickEvents = false;📝 Committable suggestion
Suggested change
| ||||||||||||||||||
| std::unique_ptr<LayoutNode> m_layoutNode; | ||||||||||||||||||
| std::optional<BaseDrawStyle> m_baseDrawStyle; | ||||||||||||||||||
| std::optional<ElementStyle> m_elementStyle; | ||||||||||||||||||
| Element(ReactImgui* view, int id, bool isRoot, bool cull); | ||||||||||||||||||
| Element(ReactImgui* view, int id, bool isRoot, bool cull, bool trackMouseClickEvents); | ||||||||||||||||||
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. 🧹 Nitpick (assertive) Update Constructor Parameter Naming If you rename the member variable for consistency, ensure the constructor parameter Apply the following diff: - Element(ReactImgui* view, int id, bool isRoot, bool cull, bool trackMouseClickEvents);+ Element(ReactImgui* view, int id, bool isRoot, bool cull, bool isTrackingMouseClickEvents);📝 Committable suggestion
Suggested change
| ||||||||||||||||||
| static std::unique_ptr<Element> makeElement(const json& val, ReactImgui* view); | ||||||||||||||||||
| @@ -72,14 +84,20 @@ class Element { | ||||||||||||||||||
| virtual ElementState GetState() const; | ||||||||||||||||||
| bool HasStyle(ElementState state); | ||||||||||||||||||
Comment on lines
+87
to
+88
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. 🛠️ Refactor suggestion Consider Marking The method Apply the following diff to mark the method as - bool HasStyle(ElementState state);+ bool HasStyle(ElementState state) const;📝 Committable suggestion
Suggested change
| ||||||||||||||||||
| [[nodiscard]] const std::optional<ElementStyleParts>& GetElementStyleParts(ElementState state) const; | ||||||||||||||||||
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. Avoid Returning Const Reference to Returning a Apply the following diff to return by value: - [[nodiscard]] const std::optional<ElementStyleParts>& GetElementStyleParts(ElementState state) const;+ [[nodiscard]] std::optional<ElementStyleParts> GetElementStyleParts(ElementState state) const;📝 Committable suggestion
Suggested change
| ||||||||||||||||||
| void DrawBaseEffects() const; | ||||||||||||||||||
| void ResetStyle(); | ||||||||||||||||||
| void SetStyle(const json& styleDef); | ||||||||||||||||||
| void ApplyStyle(); | ||||||||||||||||||
| ImRect GetScrollingAwareViewport(); | ||||||||||||||||||
| virtual std::optional<ElementStyle> ExtractStyle(const json& elementDef); | ||||||||||||||||||
Comment on lines
+99
to
+100
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. 🛠️ Refactor suggestion Consider Marking If the Apply the following diff to mark the method as - virtual std::optional<ElementStyle> ExtractStyle(const json& elementDef);+ virtual std::optional<ElementStyle> ExtractStyle(const json& elementDef) const;📝 Committable suggestion
Suggested change
| ||||||||||||||||||
| virtual void Patch(const json& elementPatchDef, ReactImgui* view); | ||||||||||||||||||
| virtual bool HasInternalOps(); | ||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
🧹 Nitpick (assertive)
Approve changes with minor grammatical correction
The addition of JetBrain's CLion as a recommended setup option and the inclusion of a visual aid are valuable improvements to the documentation. However, there's a minor grammatical issue that should be addressed.
Please apply the following change to correct the grammar:
This change ensures proper usage of the verb "recommend" with the gerund form.
📝 Committable suggestion
🧰 Tools
🪛 LanguageTool