From aa33ab4019dd965b98c93da06222c7f8cebb554b Mon Sep 17 00:00:00 2001 From: Siklos Date: Sun, 31 Jul 2022 19:12:03 +0200 Subject: [PATCH] http.js: fix width property + change default action to append --- src/App.tsx | 12 +++++++++--- test-server/http.js | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 74b3034..4cc0e29 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,7 +25,7 @@ class App extends React.Component { super(props); this.state = { isSidebarOpen: true, - isSVGSidebarOpen: true, + isSVGSidebarOpen: false, configuration: { AvailableContainers: [], AvailableSymbols: [], @@ -69,11 +69,17 @@ class App extends React.Component { return; } + const properties = this.state.configuration.AvailableContainers.find(option => option.Type === type); + + if (properties === undefined) { + throw new Error(`[AddContainer] Object type not found. Found: ${type}`); + } + const container = new Container({ id: this.state.MainContainer.props.children.length.toString(), - x: 0, + x: 0 + properties?.Width * this.state.MainContainer.props.children.length, y: 0, - width: 300, + width: properties?.Width, height: this.state.configuration.MainContainer.Height, children: [] }); diff --git a/test-server/http.js b/test-server/http.js index b375794..32ebb85 100644 --- a/test-server/http.js +++ b/test-server/http.js @@ -15,7 +15,8 @@ serve({ TypeChildContainerDefault: 'Trou', BorderWidth: 48, MinWidth: 500, - MaxWidth: 3000 + MaxWidth: 3000, + Width: 500 } ], AvailableSymbols: [],