justinmanley/Leaflet.Illustrate

read-only mode

Closed this issue · 3 comments

I'm interested in whether, once annotations are created, we can display them as a read-only layer without textbox borders, etc; similar to the readOnly property in MapKnitter's use of Leaflet.DistortableImage.

Another related question is how, and if, when done annotating, we can switch to read-only mode. As in, once you've opened the Annotations interface, written one, then want to go back to simply viewing the map with the annotation on it, the way anyone else would see it (who isn't actively annotating).

Hmmm. Am I right in understanding that this is more of a visual / aesthetic feature request than a functionality feature request?

We already support a textEditable option (which might well be renamed readonly for greater clarity) which adds the readonly attribute to the textarea containing the text annotation. If you want more than this, I think that the easiest solution would be to add a class to the textarea - say, leaflet-illustrate-textbox-readonly, and remove the border, etc. Take a look at the leaflet-illustrate-textbox class in Leaflet.Illustrate.less, which is how annotation textareas are currently being styled.

I guess it is in part UI, but partly pragmatic as well. It seems like it'd be a pretty common need to display annotations without making them editable, and although we could individually change the editability of each object, a unified way of declaring the entire set of annotations readonly.

I'm not as familiar with the polygons etc in L.Draw, but assume those can similarly be individually set to read only -- but don't see specific attributes as you've built into L.Illustrate. I see references to "edit mode" at https://github.com/Leaflet/Leaflet.draw, which would be a bit more like what I'm talking about here -- an overall mode switch which makes all objects editable or not.

Thanks for the CSS tip; I'll def do that too.

Ah - I see what you're saying - you want to also be able to turn editing on and off for all annotations that a user has permission to edit. I think that feature belongs in MapKnitter, not Leaflet.Illustrate. I suggest that you

  • Add an property to MapKnitter.Annotations containing an object which will keep track of all of the annotations on the map, keyed by their owner. Add an enableAll/disableAll method which gets the annotations owned by the current user and calls '.editing.enable() / .editing.disable()` on each annotation.
  • Add a button to the annotation toolbar which calls these methods.

Does Leaflet.Illustrate provide the methods that you need to make this happen? I think it does, but I could be wrong - let me know if that's the case.