hgiesel / closet

The Web Framework for Flashcards
https://closetengine.com
GNU General Public License v3.0
64 stars 6 forks source link

Put single field or image into occlusion mode #77

Open kleinerpirat opened 3 years ago

kleinerpirat commented 3 years ago

When hovering the IO button, the following tooltip appears:

Put all fields into occlusion mode (Ctrl+O)

This suggests to me that there is a possibility to put a single field into occlusion mode too, but I don't think that's the case.

Wouldn't it be better to only put the field into occlusion mode that contains the first image - or even more specific, only occlude the first image and leave the rest, if there are any further images in the same field? -> editable.querySelector("img")

AFAIK, there is no way to create individual occlusion commands for multiple images, and restricting the occlusion mode to the first image would make that more obvious.


Another thing I was wondering is whether it's feasible to automatically activate occlusion mode in the browser if a note contains occlusion commands? That would fit nicely with https://github.com/hgiesel/closet/issues/42 I believe.

hgiesel commented 3 years ago

I originally envisioned the occlusion mode to enable adding occlusions to any pictures, and keep track of them. Something that held me back (apart from being complicated :) ), was at the point of programming I still thought of the text [[rect1::1,2,3,4]] as an editing API. I didn't want to make it more more complicated than necessary. By now I don't think anymore anybody will go out of their to change occlusions by textually editing the coordinates :)

Being completely honest, I don't think I'll work on Closet before the next major Anki version (which looks to be 2.1.49 at the point of writing).

  1. The image resizer PR has landed in Anki, which allows me to remove all of the Closet image resizer code. The Anki image resizer is more well written, and more visually pleasing too.
  2. One more part I want to remove from Closet base is the "block" commands, like [[#abc::foo]]]bar[[/abc]], once again, because I don't think users should be editing the commands directly.
  3. In the Anki main code, I've added two overlays already, one for editing images (Image Resizer), one for editing Mathjax. If I've added some overlays for things like occlusions (rect), users could easily edit them (change coordinates, change colors, change shapes) while still being accessible. This also motivates point 2. If you look at the Mathjax editor, it pretty much resembles, how I'd like the Occlusion editor to work:
Screenshot 2021-09-18 at 21 08 29
  1. You have code (commands) in the fields, that are replaced by something visual.
  2. Clicking on it brings up an editor.
  3. (this one's more like the new Image resizer) We have something floating over the image, which can also be turned off again, is not the editor field, but absolutely positioned over it.

I've basically already programmed all the puzzle pieces, to make the perfect occlusion editor, just need to do it again :)

automatically activate occlusion mode in the browser

I'll make another issue for that.