When clicking outside the canvas and dragging and releasing over it,
several tools exhibited issues, which this commit fixes.
- Free-Form Select, Polygon: crash with IndexError
- Select: useless selection created
- Magnifier, Pick Color: returned to last tool before use
Code intended to prevent errors was also creating an offset between
the source and target regions. The source region needs to be adjusted
to match the clipped target region.
There are known knowns, and unknown knowns, and also known unknowns,
and unknown unknowns, but this is a now-no-longer-known-unknown-now-known-known, y'know? (I don't not not not not not not know.)
This was broken in "Fix a type checker error" e62064a307
where I just added `and self.offset_at_drag_start`.
The problem is that Offset defines __bool__ and are falsy when (0,0),
and the windows, despite starting out in the center, initially have an
offset of (0,0) FROM this center position.
I'm new to python package management, so I don't really know when these
packages got updated, but I'm updating this file with this command:
python3 -m pipreqs.pipreqs --ignore .history --force
This took a lot of trial and error to get this working.
- First I had to figure out how to copy the terminal output as HTML.
I had to configure keybindings for Select All and Copy As HTML in
the Ubuntu terminal.
- GitHub doesn't support line-height in markdown, so I came up with
using an SVG with <foreignObject> to contain the screenshot HTML.
- GitHub doesn't support inline SVG, so I had to use <img>, that's fine.
An external file is cleaner anyways.
- I spent a long time trying to fix the seams between rows of text.
`line-height: <font-size>` is not `line-height: 1`!
I think I tried `line-height: 1` first, but it wasn't working for some
reason so I tried a bajillion things, having mentally discounted it,
before circling back to it and trying it again and it actually worked.
- I spent a long time futzing about with SVG viewports and units.
- The text was staggered due to some of the Unicode characters, so I
developed a script to fix that up. I managed to achieve a nice
development cycle for this, but only near the end of developing it.
Most of the time while working on it I was copying and pasting
the updated code into the console after hitting up up enter to
re-run grapheme-splitter's JS.
The next commit will apply this script.
- All in all, getting this screenshot working took basically all day!
Compare that to my first day of progress on this project, having
never used the Textual framework before, and also having not used
Python for a while. In summary, coding is a land of contrasts.
- VS Code's markdown rendering isn't working with the ch/lh units.
These are pretty good candidates, paired together.
For the Free-Form Select icon (⢼⠮), I'm specifically imitating the
asymmetrical star shape from MS Paint.
I mean, let's be honest, most of these symbols are garbage candidates.
But these ones I accidentally left from trying to get ChatGPT to find
emoji for me.
More helpful were https://emojidb.org/ and http://shapecatcher.com/