playcanvas / pcui

UI component library for web-based tools
http://playcanvas.github.io/pcui
MIT License
664 stars 62 forks source link

Remove `_treeOrder` member from `TreeViewItem` #287

Closed willeastcott closed 1 year ago

willeastcott commented 1 year ago

At the moment, TreeView tags TreeViewItem instances with a number representing the depth first order of the item in the tree. This happens whenever a drag of a TreeViewItem ends. Since this member is protected, @ts-ignores are needed to silence the TypeScript compiler errors.

This PR refactors the code to no longer have to tag TreeViewItems with the order number. Instead, it creates a temporary Map of TreeViewItem to number (order).

This removes another 2 @ts-ignores and makes the TreeViewItem set of member variables that little bit cleaner. There are only 34 @ts-ignores left in the codebase.