Skip to content

Commit

Permalink
fix: solve clip planes deletAll infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jun 22, 2024
1 parent c662905 commit 8e40173
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.0.14",
"version": "2.0.15",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/core/Clipper/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ clipper.enabled = true;
*/

container.ondblclick = () => clipper.create(world);
container.ondblclick = () => {
if (clipper.enabled) {
clipper.create(world);
}
};

/* MD
Expand All @@ -128,7 +132,9 @@ container.ondblclick = () => clipper.create(world);

window.onkeydown = (event) => {
if (event.code === "Delete" || event.code === "Backspace") {
clipper.delete(world);
if (clipper.enabled) {
clipper.delete(world);
}
}
};

Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/core/Clipper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ export class Clipper

/** {@link Createable.create} */
create(world: World) {
if (!this.enabled) return;

const casters = this.components.get(Raycasters);
const caster = casters.get(world);

Expand Down Expand Up @@ -227,7 +225,6 @@ export class Clipper
* found under the cursor will be deleted.
*/
delete(world: World, plane?: SimplePlane) {
if (!this.enabled) return;
if (!plane) {
plane = this.pickPlane(world);
}
Expand Down

0 comments on commit 8e40173

Please sign in to comment.