Skip to content

Commit

Permalink
fix: hide vertex picker preview when disabling it
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jul 10, 2024
1 parent 8ea4b4a commit bed797f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 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.0",
"version": "2.1.1",
"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.0.26";
static readonly release = "2.1.1";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/utils/vertex-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export class VertexPicker extends Component implements Disposable {
*/
readonly onVertexLost = new Event<THREE.Vector3>();

/**
* An event that is triggered when the picker is enabled or disabled
*/
readonly onEnabled = new Event<boolean>();

/**
* A reference to the Components instance associated with this VertexPicker.
*/
Expand Down Expand Up @@ -79,6 +84,7 @@ export class VertexPicker extends Component implements Disposable {
if (!value) {
this._pickedPoint = null;
}
this.onEnabled.trigger(value);
}

/**
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.0",
"version": "2.1.1",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
12 changes: 12 additions & 0 deletions packages/front/src/utils/graphic-vertex-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ export class GraphicVertexPicker
/** The marker used to indicate the picked vertex. */
marker: Mark | null = null;

constructor(
components: OBC.Components,
config?: Partial<OBC.VertexPickerConfig>,
) {
super(components, config);
this.onEnabled.add((value: boolean) => {
if (this.marker) {
this.marker.visible = value;
}
});
}

/** {@link OBC.Disposable.onDisposed} */
dispose() {
if (this.marker) {
Expand Down

0 comments on commit bed797f

Please sign in to comment.