Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Locked not working as expected #2981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
E4RIJMP opened this issue Mar 4, 2025 · 6 comments · Fixed by #2993 or #3007
Closed

Locked not working as expected #2981

E4RIJMP opened this issue Mar 4, 2025 · 6 comments · Fixed by #2993 or #3007

Comments

@E4RIJMP
Copy link

E4RIJMP commented Mar 4, 2025

Hi, i don't know if it's an issue with the documentation or the implementation. But the documentation reads:

/** prevent direct resizing by the user (default?: undefined = un-constrained) */
noResize?: boolean;
/** prevents direct moving by the user (default?: undefined = un-constrained) */
noMove?: boolean;
/** same as noMove+noResize but also prevents being pushed by other widgets or api (default?: undefined = un-constrained) */
locked?: boolean;

So for locked I would assume that it does the same as noResize and noMove:

same as noMove+noResize but also ...

But if I create an item where locked is true, it can still be moved and resized via mouse. This is not the case if I create an item where noResize is true and noMove is true.

Steps to reproduce

  • Create an item where locked is true
  • Create an item noResize is true and noMove is true
  • Try to move either via mouse

https://jsfiddle.net/7uognfyp/

Expected behavior

Neither item can be resized or moved.

@adumesny
Copy link
Member

adumesny commented Mar 4, 2025

yeah, this is broken https://gridstackjs.com/demo/web2.html while demo 2 here works as expected

@adumesny
Copy link
Member

fixed in next release

@DBolderman
Copy link

This fix breaks functionality how we use this based on how it is mentioned in the documentation (https://github.com/gridstack/gridstack.js/tree/master/doc):

locked - means another widget wouldn't be able to move it during dragging or resizing. The widget can still be dragged or resized by the user. You need to add noResize and noMove attributes to completely lock the widget.

With this option we keep all present widgets on their place while moving or resizing one widget. When upgrading to version 11.5.0 all widgets are now completely locked. Adding properties noMove=false and noResize=false does not work to create the functionality as stated in the documentation.

@adumesny
Copy link
Member

adumesny commented Mar 18, 2025

@DBolderman you are absolutely correct, I keep forgeting what locked means (I don't use it) as different from the other 2 flags... and jumped to a 'fix' in a rush late at night. will revert and publish a patch. thanks for catching that....

@adumesny adumesny reopened this Mar 18, 2025
@E4RIJMP
Copy link
Author

E4RIJMP commented Mar 18, 2025

Then this documentation for locked should be changed accordingly:
same as noMove+noResize but also prevents being pushed by other widgets or api (default?: undefined = un-constrained)

https://github.com/gridstack/gridstack.js/blob/a10cba698efb2903532d6028c88047e7b7278cf8/src/types.ts#L336C2-L336C127

adumesny added a commit to adumesny/gridstack.js that referenced this issue Mar 24, 2025
SHA-1: 5321400

* Locked not working as expected

* fix gridstack#2981
@adumesny
Copy link
Member

adumesny commented Mar 24, 2025

fixed in just released v11.5.1 (and doc updated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants