diff --git a/src/mpl_widget.ts b/src/mpl_widget.ts index 7942f89..0d396e2 100644 --- a/src/mpl_widget.ts +++ b/src/mpl_widget.ts @@ -85,10 +85,21 @@ export class MPLCanvasModel extends DOMWidgetModel { view.update_canvas(); }); }); + this.on('comm_live_update', this.update_disabled.bind(this)); + + this.update_disabled(); this.send_initialization_message(); } + get disabled(): boolean { + return !this.comm_live; + } + + update_disabled(): void { + this.set('resizable', !this.disabled); + } + sync(method: string, model: WidgetModel, options: any = {}) { // Make sure we don't sync the data_url, we don't need it to be synced if (options.attrs) { @@ -315,6 +326,7 @@ export class MPLCanvasView extends DOMWidgetView { private _key: string | null; private _resize_event: (event: MouseEvent) => void; private _stop_resize_event: () => void; + render() { this.resizing = false; this.resize_handle_size = 20; diff --git a/src/toolbar_widget.ts b/src/toolbar_widget.ts index 0acf357..6671082 100644 --- a/src/toolbar_widget.ts +++ b/src/toolbar_widget.ts @@ -29,7 +29,7 @@ export class ToolbarView extends DOMWidgetView { initialize(parameters: any) { super.initialize(parameters); - this.once('comm_live_update', this.update_disabled.bind(this)); + this.on('comm_live_update', this.update_disabled.bind(this)); } render(): void {