From 42096475cd2fcc3001aa8cb9753c89cb54912fc2 Mon Sep 17 00:00:00 2001 From: Julien Finet Date: Tue, 16 Aug 2022 10:41:08 +0200 Subject: [PATCH] fix(mapper): modify mapper when clearing clipping planes Removing a clipping plane was modifying the mapper, while removing them all wasn't --- Sources/Rendering/Core/AbstractMapper/index.d.ts | 12 +++++++----- Sources/Rendering/Core/AbstractMapper/index.js | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Sources/Rendering/Core/AbstractMapper/index.d.ts b/Sources/Rendering/Core/AbstractMapper/index.d.ts index 1bb26633eb7..31a51383eb7 100755 --- a/Sources/Rendering/Core/AbstractMapper/index.d.ts +++ b/Sources/Rendering/Core/AbstractMapper/index.d.ts @@ -35,13 +35,15 @@ export interface vtkAbstractMapper extends vtkAbstractMapperBase { /** * Remove all clipping planes. + * @return true if there were planes, false otherwise. */ - removeAllClippingPlanes(): void; + removeAllClippingPlanes(): boolean; - /** - * Remove clipping plane. - * @param {vtkPlane} plane - */ + /** + * Remove clipping plane. + * @param {vtkPlane} plane + * @return true if plane existed and therefore is removed, false otherwise. + */ removeClippingPlane(plane: vtkPlane): boolean; /** diff --git a/Sources/Rendering/Core/AbstractMapper/index.js b/Sources/Rendering/Core/AbstractMapper/index.js index d3930694237..32e30c22f09 100644 --- a/Sources/Rendering/Core/AbstractMapper/index.js +++ b/Sources/Rendering/Core/AbstractMapper/index.js @@ -25,7 +25,12 @@ function vtkAbstractMapper(publicAPI, model) { publicAPI.getNumberOfClippingPlanes = () => model.clippingPlanes.length; publicAPI.removeAllClippingPlanes = () => { + if (model.clippingPlanes.length === 0) { + return false; + } model.clippingPlanes.length = 0; + publicAPI.modified(); + return true; }; publicAPI.removeClippingPlane = (clippingPlane) => {