ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.04k stars 1.2k forks source link

feature:Maintain Widget Aspect Ratio #530

Open mdconaway opened 8 years ago

mdconaway commented 8 years ago

For the purpose of my project here: https://github.com/mdconaway/vchat

I needed a dynamic option to force all gridster widgets to maintain their initial aspect ratios while also being resizeable.

I have added this feature into the code base, and by default it does not alter any behavior within gridster. To enable forced aspect ratios, a user can now simply pass in the parameter: 'maintain_aspect_ratio:boolean' as a part of the 'options' object that is sent to a gridster constructor. The aspect ratio logic uses a greatest change differential comparison to adjust the overall widget dimensions based on whether a user has made larger overall adjustments vertically or laterally.

I will create a pull request to close this feature request

jeevakannan-u commented 7 years ago

I want to have the same feature of maintaining the Aspect ratio ? How could I do that? Has this feature got merged into the original code base ?

mdconaway commented 7 years ago

Hey jeevakannan-u! I don't think the original maintainer of the project is keeping it up to date, but you can pull my branch with the fix here: https://github.com/mdconaway/gridster.js/tree/aspectRatio

mdconaway commented 7 years ago

Just a note on the link above: I have another branch of gridster (https://github.com/mdconaway/gridster.js/tree/destructorBug) where I also fixed a bug in their instance destructor. This prevents memory leaks. You should pull both branches and merge them into one mainline to have a fully corrected version of gridster. If I still used this library I would try to become a primary maintainer, but I have moved on to other things as of late.

mdconaway commented 7 years ago

Or, if you just want the distributable version of the library (with both fixes), you can just grab this single file here:

https://github.com/mdconaway/vchat/blob/master/vchat/vendor/lib/gridster.js