Skip to content

Commit 79d982c

Browse files
committed
fix highlight on hover
1 parent 2d7495f commit 79d982c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/threepp/controls/TransformControls.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -676,13 +676,11 @@ struct TransformControlsGizmo: Object3D {
676676

677677
handle->visible = this->state.axis->find(handle->name) != std::string::npos;
678678
}
679-
}
679+
}// If updating helper, skip rest of the loop
680680

681-
// If updating helper, skip rest of the loop
682681
continue;
683-
}
684682

685-
// Align handles to current local or world rotation
683+
}// Align handles to current local or world rotation
686684

687685
handle->quaternion.copy(quaternion);
688686

@@ -1045,7 +1043,6 @@ struct TransformControls::Impl {
10451043
}
10461044

10471045
void onMouseMove(const Vector2& pos) override {
1048-
if (!moveEnabled) return;
10491046
if (!scope.state.enabled) return;
10501047

10511048
const auto rect = scope.canvas.size();
@@ -1057,7 +1054,11 @@ struct TransformControls::Impl {
10571054
_pos.x = std::max(-1.f, std::min(1.f, _pos.x));
10581055
_pos.y = std::max(-1.f, std::min(1.f, _pos.y));
10591056

1060-
scope.pointerMove(button_, _pos);
1057+
scope.pointerHover(_pos);
1058+
1059+
if (moveEnabled) {
1060+
scope.pointerMove(button_, _pos);
1061+
}
10611062
}
10621063

10631064
void onMouseUp(int button, const Vector2& pos) override {
@@ -1103,6 +1104,10 @@ struct TransformControls::Impl {
11031104
_raycaster.params.lineThreshold = 0.1f;
11041105
}
11051106

1107+
~Impl() {
1108+
canvas.removeMouseListener(myMouseListener);
1109+
}
1110+
11061111
static std::optional<Intersection> intersectObjectWithRay(Object3D& object, Raycaster& raycaster, bool includeInvisible = false) {
11071112

11081113
const auto allIntersections = raycaster.intersectObject(object, true);
@@ -1489,7 +1494,7 @@ void TransformControls::updateMatrixWorld(bool force) {
14891494

14901495
pimpl_->state.eye.copy(pimpl_->state.cameraPosition).sub(pimpl_->state.worldPosition).normalize();
14911496

1492-
Object3D::updateMatrixWorld(force);
1497+
Object3D::updateMatrixWorld(true);
14931498
}
14941499

14951500
TransformControls& TransformControls::attach(Object3D& object) {

0 commit comments

Comments
 (0)