Skip to content

Commit

Permalink
fix(front): make highlightByID toggle only when picking
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Aug 7, 2024
1 parent f726fc3 commit e5b8790
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 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.1.20",
"version": "2.1.21",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Components implements Disposable {
/**
* The version of the @thatopen/components library.
*/
static readonly release = "2.1.20";
static readonly release = "2.1.21";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
2 changes: 1 addition & 1 deletion packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.1.18",
"version": "2.1.19",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
10 changes: 9 additions & 1 deletion packages/front/src/fragments/Highlighter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export class Highlighter
zoomToSelection,
exclude,
mesh,
true,
);

const fragID = Object.keys(itemFoundInFillMesh)[0];
Expand Down Expand Up @@ -286,11 +287,15 @@ export class Highlighter
removePrevious,
zoomToSelection,
exclude,
undefined,
true,
);

return { id: itemID, fragments: found };
}

// TODO: Make parameters an object?

/**
* Highlights a fragment based on a given fragment ID map.
*
Expand All @@ -300,6 +305,7 @@ export class Highlighter
* @param zoomToSelection - Whether to zoom to the highlighted selection.
* @param exclude - Fragments to exclude from the highlight.
* @param fillMesh - The fill mesh to also highlight, if any.
* @param isPicking - Whether this function is called when picking with the mouse.
*
* @returns Promise that resolves when the highlighting is complete.
*
Expand All @@ -315,6 +321,7 @@ export class Highlighter
zoomToSelection = this.zoomToSelection,
exclude: FragmentIdMap = {},
fillMesh: THREE.Mesh | undefined = undefined,
isPicking = false,
) {
if (!this.enabled) return;

Expand Down Expand Up @@ -356,7 +363,8 @@ export class Highlighter

for (const itemID of itemIDs) {
const set = this.selection[name][fragID];
if (this.autoToggle.has(name) && set.has(itemID)) {
// Only apply autotoggle when picking with the mouse
if (isPicking && this.autoToggle.has(name) && set.has(itemID)) {
deselectedIDs.add(itemID);
set.delete(itemID);
} else {
Expand Down

0 comments on commit e5b8790

Please sign in to comment.