Skip to content

Commit d65d39e

Browse files
Merge pull request #164 from GabrielDrapor/fix/hover-clipping-2
fix(shelf): hover pull-out drops the yaw — straight slide cannot clip
2 parents 22fd25f + 4aa0ec3 commit d65d39e

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

src/components/shelf3d/BookShelf3D.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -768,24 +768,21 @@ function BookMesh({
768768
// gap at the insertion point. The lerp below animates the shuffle.
769769
tx = position[0] + dragShift.current.amount;
770770
} else if (hovered && !anySelected && !processing) {
771-
// Tip the book out of the row and yaw it so the cover peeks out.
771+
// Slide the book straight out of the row (with a slight lift), no yaw.
772772
// This replaces the last-read emphasis too: the book settles back
773773
// onto the board and follows the ordinary hover animation.
774774
//
775-
// The yaw pivots around the trailing back corner instead of the
776-
// book's center: a center pivot sweeps that corner sideways into
777-
// the neighboring book (~0.1 units vs a 0.006 gap — visible
778-
// clipping). With the corner pinned, the rest of the book swings
779-
// forward-out in front of the row, which can't intersect anything.
780-
const theta = -0.3;
781-
const px = width / 2;
782-
const pz = -BOOK_DEPTH / 2;
783-
const offX = px - (px * Math.cos(theta) + pz * Math.sin(theta));
784-
const offZ = pz - (-px * Math.sin(theta) + pz * Math.cos(theta));
785-
ty = shelfY;
786-
tx = position[0] + offX;
787-
tz = position[2] + 0.46 + offZ;
788-
ry = theta;
775+
// Any yaw clips a neighbor: the row gap is 0.006 and the book is 0.7
776+
// deep, so a rotated side face sweeps ~θ·depth sideways through the
777+
// neighbor's volume no matter where the pivot sits (trailing-corner
778+
// pivots fix one side but the leading face still cuts the other).
779+
// Clearing it entirely would need a ~0.85 pull-out — the book fully
780+
// off the shelf. A straight translation cannot intersect anything;
781+
// the cover reveal stays with click-to-select, which flies the book
782+
// clear of the row before turning it.
783+
ty = shelfY + 0.04;
784+
tz = position[2] + 0.46;
785+
ry = 0;
789786
}
790787

791788
g.position.x += (tx - g.position.x) * k;

0 commit comments

Comments
 (0)