GraphiteEditor / GraphiteEditor/Graphite

Add modal tool states with the eyedropper, and implement pixel sampling in the color picker popover

未关闭
#832 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Web
主要语言
Rust
星标
27.3k
派生
1.3k
平均合并
20 小时 5 分钟
30 天内合并 PR
57

描述

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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 ColorPicker.svelte 弹出层和现有的 Eyedropper 工具开始,然后跟踪 FrontendMessage::UpdateEyedropperSamplingState。当两个 Eyedropper 入口都复用模态状态、鼠标移动能够对画布进行采样,并且 Escape 能恢复之前的视口工具状态时,工作即告完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
computer-graphics, frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。