Implement HideChildrenInTreeview
This commit is contained in:
parent
e2da3142b5
commit
3e6204e917
6 changed files with 15 additions and 2 deletions
|
@ -124,7 +124,7 @@ export function ElementsSidebar(props: IElementsSidebarProps): JSX.Element {
|
|||
isOpenClasses = props.isHistoryOpen ? 'right-64' : 'right-0';
|
||||
}
|
||||
|
||||
const it = MakeIterator(props.mainContainer);
|
||||
const it = MakeIterator(props.mainContainer, true);
|
||||
const containers = [...it];
|
||||
function Row({
|
||||
index, style
|
||||
|
|
|
@ -96,6 +96,9 @@ export interface IAvailableContainer {
|
|||
*/
|
||||
Pattern?: string
|
||||
|
||||
/** Hide the children in the treeview */
|
||||
HideChildrenInTreeview?: boolean
|
||||
|
||||
/** if true, show the dimension of the container */
|
||||
ShowSelfDimensions?: boolean
|
||||
|
||||
|
|
|
@ -57,6 +57,9 @@ export interface IContainerProperties {
|
|||
/** Horizontal alignment, also determines the visual location of x {Left = 0, Center, Right } */
|
||||
xPositionReference: XPositionReference
|
||||
|
||||
/** Hide the children in the treeview */
|
||||
hideChildrenInTreeview: boolean
|
||||
|
||||
/** if true, show the dimension of the container */
|
||||
showSelfDimensions: boolean
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ export const DEFAULT_MAINCONTAINER_PROPS: IContainerProperties = {
|
|||
isAnchor: false,
|
||||
isFlex: false,
|
||||
xPositionReference: XPositionReference.Left,
|
||||
hideChildrenInTreeview: false,
|
||||
showChildrenDimensions: true, // TODO: put the dimension at the top (see pdf)
|
||||
showSelfDimensions: true, // TODO: put the dimension at the bottom (see pdf)
|
||||
isDimensionBorrower: true, // second dimensions from the bottom
|
||||
|
@ -173,6 +174,7 @@ export function GetDefaultContainerProps(type: string,
|
|||
xPositionReference: containerConfig.XPositionReference ?? XPositionReference.Left,
|
||||
minWidth: containerConfig.MinWidth ?? 1,
|
||||
maxWidth: containerConfig.MaxWidth ?? Number.MAX_SAFE_INTEGER,
|
||||
hideChildrenInTreeview: containerConfig.HideChildrenInTreeview ?? false,
|
||||
showChildrenDimensions: containerConfig.ShowChildrenDimensions ?? false,
|
||||
showSelfDimensions: containerConfig.ShowSelfDimensions ?? false,
|
||||
markPositionToDimensionBorrower: containerConfig.MarkPositionToDimensionBorrower ?? false,
|
||||
|
|
|
@ -3,7 +3,7 @@ import { IContainerModel } from '../Interfaces/IContainerModel';
|
|||
/**
|
||||
* Returns a Generator iterating of over the children depth-first
|
||||
*/
|
||||
export function * MakeIterator(root: IContainerModel): Generator<IContainerModel, void, unknown> {
|
||||
export function * MakeIterator(root: IContainerModel, enableHideChildrenInTreeview = false): Generator<IContainerModel, void, unknown> {
|
||||
const queue: IContainerModel[] = [root];
|
||||
const visited = new Set<IContainerModel>(queue);
|
||||
while (queue.length > 0) {
|
||||
|
@ -11,6 +11,10 @@ export function * MakeIterator(root: IContainerModel): Generator<IContainerModel
|
|||
|
||||
yield container;
|
||||
|
||||
if (enableHideChildrenInTreeview && container.properties.hideChildrenInTreeview) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let i = container.children.length - 1; i >= 0; i--) {
|
||||
const child = container.children[i];
|
||||
if (visited.has(child)) {
|
||||
|
|
|
@ -81,6 +81,7 @@ const GetSVGLayoutConfiguration = () => {
|
|||
stroke: 'red',
|
||||
fill: '#d3c9b7',
|
||||
},
|
||||
HideChildrenInTreeview: true,
|
||||
ShowSelfDimensions: true,
|
||||
IsDimensionBorrower: true,
|
||||
Category: "Stuff"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue