nikitasnv / vue-resizable

VueResizable component
https://nikitasnv.github.io/vue-resizable/
MIT License
224 stars 46 forks source link

Resize to parentElement option on handleUp #11

Open kas84 opened 4 years ago

kas84 commented 4 years ago

Hi! Would you be open to adding an option to resizing the element to the size of its parent when handlingUp? Something like:

if (this.resizeToParentSize) this.w = this.$el.parentElement.clientWidth;

In my case I need to calculate the size on the elements parent as a percentage (like the full width is 24h and I want it to be resizable for each hour or half an hour).

On the parent I have a div like this:

<div :style="getStyle(data)"></div>

And this getStyle is calculating the width as a percentage basing on the data.

nikitasnv commented 3 years ago

Do you still have a problem?

kas84 commented 3 years ago

Yes, even though I'm not really using it, because I encountered other problems with a virtual scroll library

nikitasnv commented 3 years ago

I will not add additional parameters for the component if it is not needed. Have you tried setting the correct dimensions when calculating the data (width, height props)?

kas84 commented 3 years ago

I will revisit this problem this week. I will let you know... The main problem for me was that it was not working correctly with a virtual scroll library, but maybe it was because of my resize to parentElement option.