Skip to content

Commit

Permalink
Don't try to use the activity bar if it isn't enabled (#63)
Browse files Browse the repository at this point in the history
Fixes #59
  • Loading branch information
XiangYyang authored Nov 19, 2023
1 parent 02b699b commit 5ea1e76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions debug/embedded.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed src="examples/pins.kicad_sch" controls="basic">
</kicanvas-embed>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<kicanvas-embed src="examples/starfish.kicad_pcb" controls="full">
</kicanvas-embed>
<p>
Expand Down
7 changes: 5 additions & 2 deletions src/kicanvas/elements/common/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export abstract class KCViewerAppElement<
ViewerElementT extends ViewerElement,
> extends KCUIElement {
#viewer_elm: ViewerElementT;
#activity_bar: KCUIActivitySideBarElement;
#activity_bar: KCUIActivitySideBarElement | null;

project: Project;
viewerReady: DeferredPromise<boolean> = new DeferredPromise<boolean>();
Expand Down Expand Up @@ -180,7 +180,7 @@ export abstract class KCViewerAppElement<
protected abstract make_activities(): ElementOrFragment[];

protected change_activity(name?: string) {
this.#activity_bar.change_activity(name);
this.#activity_bar?.change_activity(name);
}

protected abstract make_viewer_element(): ViewerElementT;
Expand Down Expand Up @@ -208,6 +208,9 @@ export abstract class KCViewerAppElement<
${pre_activities} ${activities} ${post_activities}
</kc-ui-activity-side-bar>` as KCUIActivitySideBarElement;
resizer = html`<kc-ui-resizer></kc-ui-resizer>`;
} else {
// NO activity bar
this.#activity_bar = null;
}

const top_toolbar_buttons = [];
Expand Down

0 comments on commit 5ea1e76

Please sign in to comment.