From 99c75e56e2fd0c96a393a818c195739366a618dc Mon Sep 17 00:00:00 2001 From: Tom Suchel Date: Tue, 14 Jun 2022 11:34:02 +0200 Subject: [PATCH] feat(linewidget): add reset function to LineWidget The LineWidget was missing a `publicAPI.reset()` function, that can be usefull to reset the widget without deleting it. --- Sources/Widgets/Widgets3D/LineWidget/behavior.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sources/Widgets/Widgets3D/LineWidget/behavior.js b/Sources/Widgets/Widgets3D/LineWidget/behavior.js index 454ec67dc3c..ccad9afc4bd 100644 --- a/Sources/Widgets/Widgets3D/LineWidget/behavior.js +++ b/Sources/Widgets/Widgets3D/LineWidget/behavior.js @@ -391,4 +391,17 @@ export default function widgetBehavior(publicAPI, model) { model._widgetManager.enablePicking(); model._interactor.render(); }; + + publicAPI.reset = () => { + model.widgetState.deactivate(); + model.widgetState.getMoveHandle().deactivate(); + + model.widgetState.getHandle1().setOrigin(null); + model.widgetState.getHandle2().setOrigin(null); + model.widgetState.getMoveHandle().setOrigin(null); + model.widgetState.getText().setOrigin(null); + model.widgetState.getText().setText(''); + + model.activeState = null; + }; }