Skip to content

Commit f1bebfc

Browse files
committed
prevent 'r' rotation to items that can't resize
* fix gridstack#2694 * not tested as I don't have my dev machine right now
1 parent fec86f2 commit f1bebfc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Change log
112112

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

116117
## 10.2.0 (2024-06-02)
117118
* 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.

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ export class GridStack {
14501450
public rotate(els: GridStackElement, relative?: Position): GridStack {
14511451
GridStack.getElements(els).forEach(el => {
14521452
let n = el.gridstackNode;
1453-
if (!n || n.w === n.h) return;
1453+
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;
14541454
const rot: GridStackWidget = { w: n.h, h: n.w, minH: n.minW, minW: n.minH, maxH: n.maxW, maxW: n.maxH };
14551455
// if given an offset, adjust x/y by column/row bounds when user presses 'r' during dragging
14561456
if (relative) {

0 commit comments

Comments
 (0)