GraphiteEditor / GraphiteEditor/Graphite

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

オープン
#832 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Web
主要言語
Rust
スター
27.2k
フォーク
1.3k
平均マージ
20時間 5分
マージ済み PR(30日)
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start with the ColorPicker.svelte popover and the existing Eyedropper tool, then trace FrontendMessage::UpdateEyedropperSamplingState. The work is complete when both eyedropper entry points reuse the modal state, mouse movement samples the canvas, and Escape restores the previous viewport tool state.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
computer-graphics, frontend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。