-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: composite ordering #679
Conversation
Deploying with Β Β Cloudflare Pages
|
e8965bf
to
ec95beb
Compare
Test this pull request
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #679 +/- ##
==========================================
+ Coverage 74.12% 74.51% +0.39%
==========================================
Files 306 311 +5
Lines 10256 10439 +183
Branches 1327 1352 +25
==========================================
+ Hits 7602 7779 +177
- Misses 2530 2535 +5
- Partials 124 125 +1
β View full report in Codecov by Sentry. |
ec38548
to
eeb7164
Compare
1622038
to
26613a9
Compare
I think there's a styling issue, when I drag a child over a parent it shows the indicator that it will be placed after the parent, but it moves it inside (where it already was, so it does nothing, but the indicator suggests that it would be moved outside, below the parent). reorder.mp4 |
yeah, it's the correct behaviour but the wrong UI. Will take a look at it π |
ca09b28
to
18a5aec
Compare
I think when a node has children it's not possible to drag an entity after it? Look at this example, test1 has children (test2), and I can't drag test4 between test1 and test3: reorder2.mp4Also there seems to be 2 hover states? One that puts the dropped entity inside at the top and the other puts the entity inside at the bottom of the list. I think it would also be nice to highlight somehow when an entity is going to be dropped inside another, because currently we have the "after" hightlight but the "inside" doesnt actually highlight anything |
18a5aec
to
18cff3e
Compare
18cff3e
to
f05885d
Compare
closes decentraland/sdk#871
π€ Generated by Copilot at 18a5aec
Summary
π²π οΈπ
This pull request adds drag and drop functionality to the
Hierarchy
andProjectView
components, and introduces a newNodes
component to store and manipulate the entity hierarchy in the scene. It also updates theuseTree
hook, the@dcl/inspector
operations, and some migration functions to use theNodes
component. It fixes some bugs and code style issues, and adds some tests and utils for the new features.Walkthrough
Nodes
component to store the hierarchy of the entities in the scene (link, link, link, link, link)Node
type to represent a node in the hierarchy, with anentity
and achildren
property (link, link)DropType
type andcalculateDropType
function to handle different types of drop events for the drag and drop feature of theTree
component (link, link)DisclosureWidget
component to render the arrow icon that indicates if a node can be expanded or collapsed (link)canDrag
andcanReorder
props to theTree
component, to determine if a node can be dragged and reordered (link, link, link, link, link, link)canDrag
andcanReorder
functions to theuseTree
hook, to provide some validation logic for the drag and drop feature (link)reorder
function to theoperations
object, to reorder the nodes in theNodes
component value based on the source, target, and new parent entities (link, link)runMigrations
function to perform some migrations on the engine context, such as removing the oldEntityNode
components and building theNodes
component value if it does not exist (link, link)buildNodesHierarchy
andbuildNodesHierarchyIfNotExists
functions to build theNodes
component value from the current engine status (link)pushChild
andremoveNode
functions to add or remove a node from the tree, and return the updated tree (link, link)buildNodesHierarchy
andbuildNodesHierarchyIfNotExists
functions, using different composites and engine contexts (link)onSetParent
prop toonDrop
in theHierarchy
andProjectView
components, to reflect the new logic of handling different types of drop events (link, link)useDrop
hook logic in theTree
component, to use thecalculateDropType
function and thecanReorder
function, and to pass the drop type value to theonDrop
prop function (link)setParent
function in theuseTree
hook, to use thegetNewParent
function and thereorder
function, and to handle different types of drop events (link)useTree
hook logic, to use theNodes
component instead of theTransform
component, and to return an array of nodes (link, link, link)addChild
function, to return the child entity and to update theNodes
component value with thepushChild
function (link)removeEntity
function, to update theNodes
component value with theremoveNode
function for every entity iterator in the component entity tree (link)generateMinimalComposite
andgenerateMainComposite
functions, to add theNodes
component to the engine and set its value to the minimal or main hierarchy (link, link)createTempEngineContext
andgenerateMinimalComposite
functions, to export them as named exports (link, link)generateMainComposite
function, to add thegltfEntity
to the engine before creating its components, and to remove the duplicate line that adds it again (link, link)Tree
component and its CSS styles, to add some border styles for different drop types and to adjust the margin and padding for the tree and the item area (link, link, link, link)Tree
component, to use a ref for the item area element and to pass thedrag
anddrop
functions to it (link, link, link)Tree
component, to use a custom component for the disclosure widget and to simplify the rendering of the children nodes (link, link)initRpcMethods
function, to remove the call to theremoveLegacyEntityNodeComponents
function (link)removeLegacyEntityNodeComponents
function, to move it to themigrations
folder (link)jest-puppeteer.config.js
file (link)removeLegacyEntityNodeComponents
function from therpc-methods.ts
file (link)