ailon / markerjs2

Add image annotation to your web apps.
https://markerjs.com
Other
142 stars 39 forks source link

Question: Is there a way to change the width of popup container? #131

Closed ylc395 closed 1 year ago

ylc395 commented 2 years ago

https://github.com/ailon/markerjs2/blob/f57c0481b15bfbaa2d8273a5b485e44b6be2746a/src/MarkerArea.ts#L976

It seems that 100vw is hard-coded. Is there a way to set it to other value, such as 100% since targetRoot is probably not document.body?

ailon commented 2 years ago

Hmm... Could you elaborate on the use case in practical terms? My thinking is that popup is a popup in a window and shouldn't really care about the targetRoot. Otherwise, I would assume inline mode should make more sense. But maybe I'm missing something.

ylc395 commented 2 years ago

If we use markerjs2's editor in a size-fixed container, inline mode doesn't help (editor's size depends on the image's size under inline mode). So I use popup mode instead. For example:

image

Here is my setting:

markerArea.targetRoot = divRef.current; // third column's dom element
markerArea.settings.displayMode = 'popup';
markerArea.settings.popupMargin = 0;
ailon commented 2 years ago

Thanks! I'll think about it and look into it. I'm not 100% sure a simple change won't have any messed up side-effects.