mirror of
https://github.com/1j01/textual-paint.git
synced 2024-08-17 03:40:26 +03:00
Allow right click to pick foreground color from palette
This commit is contained in:
parent
833f0fac48
commit
778ecb2b8a
@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- Added `--ascii-only` option which affects the whole UI, not just tool icons as with `--ascii-only-icons`; this makes Textual Paint more usable in older terminals like Windows Console Host (`conhost.exe`), or XTerm.
|
||||
- Right click can now be used as an alternative to Ctrl+click to pick a foreground color from the palette. In XTerm, Ctrl opens a context menu, so this is the only way in XTerm. It's also more convenient.
|
||||
- Note: Left click in MS Paint selects the foreground (primary) color, whereas in Textual Paint it selects the background color, which is, strangely, essentially the primary color, since you draw with a space character by default. It may be worth changing the default character to a full block character (█), and swapping these mouse button mappings, to bring it in line with MS Paint. This would also allow drawing "pixels" and saving as a plain text file without it all becoming blank when color information is discarded.
|
||||
- Side note: I was previously saving right click for a possible future UI where the foreground and background selections both have a foreground, background, and glyph, with the three components being analogous to a single color in MS Paint. I haven't explored that idea yet. It's likely too complicated conceptually, but it would allow more granular color replacement with the Color Eraser tool (if that's even desirable), and quicker access to two different glyphs.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -148,7 +148,9 @@ Note that metadata is not preserved when opening and saving image files. This is
|
||||
You can draw with a character by clicking the selected color display area in the palette and then typing the character,
|
||||
or by double clicking the same area to pick a character from a list.
|
||||
|
||||
You can set the text color by holding Ctrl while clicking a color in the palette, or while double clicking a color to open the Edit Colors dialog.
|
||||
You can set the text color by right clicking or holding <kbd>Ctrl</kbd> while clicking a color in the palette.
|
||||
Also, if you double right click or hold <kbd>Ctrl</kbd> while double clicking on a color to open the Edit Colors dialog,
|
||||
if will edit the text color when you click OK.
|
||||
|
||||
You can display a saved ANSI file in the terminal with `cat`:
|
||||
|
||||
|
@ -553,11 +553,12 @@ class ColorsBox(Container):
|
||||
button, _ = self.app.get_widget_at(*event.screen_offset)
|
||||
if "color_button" in button.classes:
|
||||
assert isinstance(button, Button)
|
||||
self.post_message(self.ColorSelected(self.color_by_button[button], event.ctrl))
|
||||
secondary = event.ctrl or event.button == 3
|
||||
self.post_message(self.ColorSelected(self.color_by_button[button], secondary))
|
||||
# Detect double click and open Edit Colors dialog.
|
||||
if event.time - self.last_click_time < 0.8 and button == self.last_click_button:
|
||||
assert isinstance(self.app, PaintApp)
|
||||
self.app.action_edit_colors(self.query(".color_button").nodes.index(button), event.ctrl)
|
||||
self.app.action_edit_colors(self.query(".color_button").nodes.index(button), secondary)
|
||||
self.last_click_time = event.time
|
||||
self.last_click_button = button
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user