Skip to content

Commit

Permalink
Merge pull request #2699 from adumesny/master
Browse files Browse the repository at this point in the history
prevent 'r' rotation to items that can't resize
  • Loading branch information
adumesny authored Jun 13, 2024
2 parents c0cd6ae + f1bebfc commit 06e558b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Change log

## 10.2.0-dev (TBD)
* fix: [#2683](https://github.com/gridstack/gridstack.js/issues/2683) check for fixed grid maxRow during resize
* fix: [#2694](https://github.com/gridstack/gridstack.js/issues/2694) prevent 'r' rotation to items that can't resize (locked, noResize, fixed sizes)

## 10.2.0 (2024-06-02)
* feat: [#2682](https://github.com/gridstack/gridstack.js/pull/2682) You can now press 'Esc' to cancel a move|resize, 'r' to rotate during a drag. added `GridStack.rotate()` as well - Thank you John B. for this feature sponsor.
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ export class GridStack {
public rotate(els: GridStackElement, relative?: Position): GridStack {
GridStack.getElements(els).forEach(el => {
let n = el.gridstackNode;
if (!n || n.w === n.h) return;
if (!n || n.w === n.h || n.locked || n.noResize || n.grid?.opts.disableResize || (n.minW && n.minW === n.maxW) || (n.minH && n.minH === n.maxH)) return;
const rot: GridStackWidget = { w: n.h, h: n.w, minH: n.minW, minW: n.minH, maxH: n.maxW, maxW: n.maxH };
// if given an offset, adjust x/y by column/row bounds when user presses 'r' during dragging
if (relative) {
Expand Down

0 comments on commit 06e558b

Please sign in to comment.