GraphiteEditor / GraphiteEditor/Graphite
Add modal tool states with the eyedropper, and implement pixel sampling in the color picker popover
- Ngôn ngữ chính
- Rust
- Star
- 27.2k
- Fork
- 1.3k
- Merge trung bình
- 20 giờ 5 phút
- Pull request đã merge (30 ngày)
- 57
Mô tả
A "modal tool state" is a temporary state where a tool can present a simple mouse-based interaction, which takes precedence over the active tool. It shows hints, a custom cursor, and can direct messages on the different events (mousedown, mousemove, mouseup, keyboard modifiers, and keyboard events).
The first example, which this issue covers, is the eyedropper modal tool state. This should be activated by clicking the eyedropper icon in the ColorPicker.svelte popover. Also, the existing Eyedropper tool (accessible in the tool shelf as a full-blown tool) should, upon clicking with LMB or RMB, activate this modal tool to reuse its code. The modal tool state will need the current mouse position every frame it's moved (mousemove event) so it can send a `FrontendMessage::UpdateEyedropperSamplingState` message with the canvas position and other details. For this one, hitting Escape should exit the modal tool state and return back to whatever viewport tool the user was doing, in whatever state it was in.
Other future modal tool states, to provide some examples to understand how this feature will be used:
- "Pick a layer to reference" (in the Properties panel for a particular node that needs the input of another node/layer as a reference, Blender has something similar for picking a specific 3D object to reference when setting up shader nodes or other things)
- "Quick export" where you press a hotkey and drag a rectangle to instantly download a "screenshot" of that part of the canvas
- "Paste style" where you right click an object, click *Copy/Paste Style* from the context menu, and your cursor becomes a paste modal where you click on an object to paste the copied style on it as a target
- Other things where you hit a hotkey to enter the mode briefly and can use your mouse to interact on a temporary basis, usually where Escape exits the mode and returns to whatever actual tool you were using
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
Hướng nghiên cứu
Bắt đầu với popover của ColorPicker.svelte và công cụ Eyedropper hiện có, sau đó lần theo FrontendMessage::UpdateEyedropperSamplingState. Công việc hoàn tất khi cả hai điểm vào của Eyedropper đều sử dụng lại trạng thái modal, chuyển động của chuột lấy mẫu canvas và Escape khôi phục trạng thái trước đó của công cụ viewport.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- computer-graphics, frontend
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100