Skip to content

Commit af8404d

Browse files
committed
feat: pass plane to Clipper events
1 parent 28f43b1 commit af8404d

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/core/src/core/Clipper/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export class Clipper
4040
readonly onSetup = new Event();
4141

4242
/** Event that fires when the user starts dragging a clipping plane. */
43-
readonly onBeforeDrag = new Event<void>();
43+
readonly onBeforeDrag = new Event<SimplePlane>();
4444

4545
/** Event that fires when the user stops dragging a clipping plane. */
46-
readonly onAfterDrag = new Event<void>();
46+
readonly onAfterDrag = new Event<SimplePlane>();
4747

4848
/**
4949
* Event that fires when the user starts creating a clipping plane.
@@ -409,8 +409,8 @@ export class Clipper
409409
this._material,
410410
);
411411
plane.autoScale = this.autoScalePlanes;
412-
plane.onDraggingStarted.add(this._onStartDragging);
413-
plane.onDraggingEnded.add(this._onEndDragging);
412+
plane.onDraggingStarted.add(() => this.onBeforeDrag.trigger(plane));
413+
plane.onDraggingEnded.add(() => this.onAfterDrag.trigger(plane));
414414
const id = UUID.create();
415415
this.list.set(id, plane);
416416
this.onAfterCreate.trigger(plane);
@@ -440,11 +440,4 @@ export class Clipper
440440
}
441441
}
442442

443-
private _onStartDragging = () => {
444-
this.onBeforeDrag.trigger();
445-
};
446-
447-
private _onEndDragging = () => {
448-
this.onAfterDrag.trigger();
449-
};
450443
}

0 commit comments

Comments
 (0)