anseki / plain-draggable

The simple and high performance library to allow HTML/SVG element to be dragged.
https://anseki.github.io/plain-draggable/
MIT License
774 stars 99 forks source link

Inline style rewritten by window onscroll event #148

Closed typebrook closed 1 month ago

typebrook commented 1 month ago

Related issue #125 #124

Reproduce with Example:

  1. resize paragraph element with red border line
  2. scroll element to the end, and scroll up
  3. element's inline style "width" and "height" are erased

@anseki Is there any way to keep inline style after recalculate for scroll event?

anseki commented 1 month ago

Hi @typebrook, thank you for the comment.

That case and #125 are completely unrelated. PlainDraggable has to reset style properties of the target element to recalculate the position and layout. That is, the style properties of the target element should not be changed intendedly after initialization. The simple and easy solution is wrapping your contents by another element. For example

BTW, this example uses ResizeObserver for capture resizing the target element.

typebrook commented 1 month ago

the style properties of the target element should not be changed intendedly after initialization.

I see. Really grateful about your quick reply and detailed solution, you are awesome!

typebrook commented 1 month ago

That case and #125 are completely unrelated.

My bad... it should be #124

anseki commented 1 month ago

😄