Skip to content

Commit

Permalink
Fix saving issues with resizeable panels
Browse files Browse the repository at this point in the history
Co-authored-by: frcroth <[email protected]>
Co-authored-by: Paula-Kli <[email protected]>
  • Loading branch information
3 people committed Jun 14, 2021
1 parent 93ed418 commit a6fb5cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ const CONSTANTS = {
MENU_BAR_WIDGET_WIDTH: 100,
MENU_BAR_WIDGET_HEIGHT: 25,
FONT_SIZE_TEXT: 18,
FONT_SIZE_HEADINGS: 20
FONT_SIZE_HEADINGS: 20,
SCROLL_BAR_HEIGHT: 10
};
CONSTANTS.SIDEBAR_WIDTH = (CONSTANTS.EDITOR_WIDTH - CONSTANTS.PREVIEW_WIDTH) / 2;
CONSTANTS.TIMELINE_HEIGHT = CONSTANTS.EDITOR_HEIGHT - CONSTANTS.SUBWINDOW_HEIGHT - CONSTANTS.MENU_BAR_HEIGHT;
Expand Down Expand Up @@ -231,7 +232,7 @@ export class InteractivesEditor extends QinoqMorph {
this._latestSubWindowRatio = this.ui.subWindow.height / this.height;
}

const topWindowHeight = this.ui.subWindow.top;
const topWindowHeight = this.ui.subWindow.top - CONSTANTS.SCROLL_BAR_HEIGHT;

this.ui.interactiveGraph.extent = pt(this.ui.interactiveGraph.width, topWindowHeight);

Expand Down
1 change: 0 additions & 1 deletion interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export class Interactive extends DeserializationAwareMorph {
defaultValue: 16 / 9,
set (aspectRatio) {
this.setProperty('fixedAspectRatio', aspectRatio);
// eslint-disable-next-line no-self-assign
this.extent = this.applyAspectRatio(this.extent);
}
},
Expand Down
9 changes: 5 additions & 4 deletions utilities/resizeable-panel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Morph } from 'lively.morphic';
import { pt, Color } from 'lively.graphics';
import { connect, disconnectAll } from 'lively.bindings';
import { DeserializationAwareMorph } from './deserialization-morph.js';
import { Morph } from 'lively.morphic';

const CONSTANTS = {
DEFAULT_RESIZER_WIDTH: 4
Expand All @@ -12,7 +13,7 @@ These can be individually enabled programmatically and are layouted correctly wh
E.g. the north resizer will position itself always at the top of the panels on resizements.
It can be used e.g. as a container when creating applications with resizable sub-windows.
*/
export class ResizeablePanel extends Morph {
export class ResizeablePanel extends DeserializationAwareMorph {
static get properties () {
return {
ui: {
Expand Down Expand Up @@ -41,7 +42,7 @@ export class ResizeablePanel extends Morph {
}
: resizersOrBoolean;
this.setProperty('resizers', resizers);
this.updateResizers();
if (!this._deserializing) this.updateResizers();
}
},
extent: {
Expand Down Expand Up @@ -206,7 +207,7 @@ export class ResizeablePanel extends Morph {
}

relayout () {
Object.keys(this.ui.resizers).forEach(side => {
Object.keys(this.ui.resizers).filter(key => key != '_rev').forEach(side => {
const resizer = this.ui.resizers[side];
switch (side) {
case 'north':
Expand Down

0 comments on commit a6fb5cb

Please sign in to comment.