Skip to content

Commit

Permalink
open new views at the beginning (#242)
Browse files Browse the repository at this point in the history
- closes #241
  • Loading branch information
foxriver76 authored Dec 10, 2023
1 parent c1d4c38 commit 8e52f44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) open new views at the beginning
* (foxriver76) fixed crash case if signals are used
* (foxriver76) fixed material-design-widgets helper
* (foxriver76) update references to view in widget when view is renamed
Expand Down
10 changes: 5 additions & 5 deletions src/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,12 @@ class App extends Runtime {
}
};

toggleView = async (view, isShow, isActivate) => {
toggleView = async (view, isShow, isActivate = false) => {
let changed = false;
const project = JSON.parse(JSON.stringify(store.getState().visProject));
const project = deepClone(store.getState().visProject);
const pos = project.___settings.openedViews.indexOf(view);
if (isShow && pos === -1) {
project.___settings.openedViews.push(view);
project.___settings.openedViews.unshift(view);
changed = true;
} else if (!isShow && pos !== -1) {
project.___settings.openedViews.splice(pos, 1);
Expand Down Expand Up @@ -1345,8 +1345,8 @@ class App extends Runtime {
askAboutInclude = (wid, toWid, cb) => this.setState({ askAboutInclude: { wid, toWid, cb } });

renderTabs() {
const views = Object.keys(store.getState().visProject)
.filter(view => !view.startsWith('__') && store.getState().visProject.___settings.openedViews.includes(view));
const { visProject } = store.getState();
const views = visProject.___settings.openedViews.filter(view => Object.keys(visProject).includes(view));

return <div className={this.props.classes.tabsContainer}>
{this.state.hidePalette ? <Tooltip title={I18n.t('Show palette')}>
Expand Down

0 comments on commit 8e52f44

Please sign in to comment.