💡 Full floating attach corners (element + parent)

Đang mở
#83 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
c, typescript
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Bắt đầu tại ops.ts:168 và bài kiểm thử bị lỗi trong nm/repro/floating-attach/test/floating-attach.test.ts. So sánh packing ở đó với việc giải mã trường được mô tả tại src/clayterm.c:546, bao gồm dạng attach-point số và giá trị mặc định của parent. Được xem là hoàn tất khi cả hai trường hợp dot.x được báo cáo đều neo vào góc parent được yêu cầu, zIndex được giữ nguyên và hành vi hiện có của dạng số vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement high priority

Is your feature request related to a problem?

A floating element can choose where it attaches, but not where it attaches on its parent. The floating.attachTo: PARENT path always anchors to the parent's top-left corner, so a width:5 parent's float that asks to sit at the parent's right edge should land at dot.x = parent.x(0) + parent.width(5) = 5 but lands at 0. Underneath, we pack zIndex directly over the parent-corner slot and never write the z-index bits, so floating.zIndex: 5 actually sets the parent corner and the requested z-index is dropped.

Describe the solution you'd like

Make the parent corner first-class via a structured attachPoints.{element, parent} (exact names TBD), each one of Clay's 9 attach points; the element corner anchors onto the chosen parent corner:

open("dot", {
  floating: {
    attachTo: ATTACH_TO_PARENT,
    attachPoints: {
      element: 0,
      parent: 6,
    }, // element LEFT_TOP onto parent RIGHT_TOP
  },
});

The 9 attach points form a 3×3 grid around the parent, mirroring CSS anchor positioning's position-area. C already decodes both corners and z-index, so the fix is JS-side: pack element into bits 8-15, parent into 16-23, and move zIndex to 24-31. The number form keeps working as the element corner with parent defaulting to LEFT_TOP.

Describe alternatives you've considered

Compute the offset yourself—read the parent's info bounds from a prior render and set floating.x to parent.width. That needs a two-pass render, breaks on resize, can't express vertical anchors, and leaves zIndex unusable.

Additional context

Failing test case on nm/repro/floating-attach (test · diff); both cases report dot.x = 0 today. The change likely lives in ops.ts:168 (pack mis-slots attachPoints/zIndex); src/clayterm.c:546 already reads parent from bits 16-23 and zIndex from 24-31.

Ngôn ngữ chính
TypeScript
Star
42
Fork
2
Merge trung bình
2 ngày 5 giờ
Pull request đã merge (30 ngày)
12

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bombshell-dev/tty

Tất cả issue của bombshell-dev/tty

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.