Skip to content

Commit

Permalink
fix(mapper): modify mapper when clearing clipping planes
Browse files Browse the repository at this point in the history
Removing a clipping plane was modifying the mapper, while removing them all wasn't
  • Loading branch information
finetjul committed Aug 16, 2022
1 parent 62e5140 commit 4209647
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Sources/Rendering/Core/AbstractMapper/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
5 changes: 5 additions & 0 deletions Sources/Rendering/Core/AbstractMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 4209647

Please sign in to comment.