Switching between images to annotate
From @mprostock:
My main question, which I can't seem to figure out: How do you envision switching between images to annotate, what is the correct process for that? In all use cases I know, this is one of the main processes: annotate -> next image -> annotate ->next image etc. All of the portal use-cases only demonstrate usage with a single image though.
By design, dash-canvas ALWAYS triggers the canvas.json-data callback if anything is changed. So using the "go_button" (renamed to "next") within the component practically makes it impossible to trigger image changes. The following things I have tried:
-
change the "image_content" property after using the callback: Doesn't work, because it triggers a circular callback (changing image_content retriggers the callback...)
-
reinstantiate the entire component (putting the entire dash_canvas component into an output of type Output('canvas-div', 'children'). This should work from my perspective (though it is very inefficient), but it always only works for the first few images and then starts the above cycle of circular callbacks somehow on its own (so something again triggers the json callback apparently, reproducible but not consistent!)
-
try to make use of the new dash.callback_context object, which should have the actual cause of the callback within its 'triggered' list, but apparently the only property in dash-canvas is the entire json of changes, so the context is useless in this case.
What am I missing? Is there a way, short of NOT using the dash_canvas internal buttons (which seems kind of beside the point and I also can't find a way to hide the go-button, it seems mandatory?)
One additional observation: The json-data always includes the actual image itself in base64 encoding. Considering that in all "normal" usecases, the image will be provided by the backend anyways, this is really inefficient and wasteful for the amount of data permanently send between backend and client, it would be better to just include the annotations. I imagine that the react component, which was designed to sketch, does that by default, but for the annotation usecase that is really unneccessary, maybe it could be made optional?