diff --git a/src/svgViewer.ide.ts b/src/svgViewer.ide.ts index 5a1e52f..454d4a3 100644 --- a/src/svgViewer.ide.ts +++ b/src/svgViewer.ide.ts @@ -121,6 +121,9 @@ export class SvgViewerWidget extends TWComposerWidget { description: 'Pans onto the selected element in the svg. PanAndZoom must be enabled for this to work.', }, + ResetSelection: { + description: 'Resets the selection, and leaves no element selected', + }, }; } diff --git a/src/svgViewer.runtime.ts b/src/svgViewer.runtime.ts index b4ddd9c..5ce47a9 100644 --- a/src/svgViewer.runtime.ts +++ b/src/svgViewer.runtime.ts @@ -3,9 +3,6 @@ import { TWWidgetDefinition, property, - canBind, - TWEvent, - event, service, } from 'typescriptwebpacksupport/widgetRuntimeSupport'; import { @@ -69,6 +66,13 @@ export class SvgViewerWidget extends TWRuntimeWidget { this.svgRenderer.panOntoElement(); } } + + @service('ResetSelection') + ResetSelection(): void { + this.svgRenderer.triggerElementSelectionByName([]); + this.updateSelection('Data', []); + } + renderHtml(): string { require('./styles/runtime.css');