You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What the title says. This is a feature that was part of 9.5.0 and there is even a demo here: https://gridstackjs.com/demo/transform.html#
However, if the grid is set to acceptWidgets from outside, and you drag an element out of the grid then drag it back in (even if it's from the same grid), then the position of the cursor will follow the unscaled grid instead
Your environment
version of gridstack.js - 10.0.1
which browser/OS - Chrome/MacOS
Steps to reproduce
Here is a fiddle of the two vertical grids demo, but with scale(0.5) applied: https://jsfiddle.net/e2t65s1d/
Additionally, you can paste this code yourself if the fiddle does not work for some reason:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Two vertical grids demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://gridstackjs.com/demo/demo.css"/>
<script src="https://gridstackjs.com/node_modules/gridstack/dist/gridstack-all.js"></script>
</head>
<body>
<div class="container-fluid" style="transform: scale(0.5)">
<h1>Two vertical grids demo - with maxRow</h1>
<p>special care is needed to prevent top grid from growing and causing shifts while you are dragging (which is a know issue).<br>
You can either set a fix row, or have enough padding on a parent div to allow for an extra row to be created as needed), or....</p>
<div class="grid-stack" id="grid1"></div>
<br>
<div class="grid-stack" id="grid2"></div>
</div>
<script src="events.js"></script>
<script type="text/javascript">
let opts = {
row: 1, // set min and max row to freeze the height
dragOut: true,
acceptWidgets: true
}
GridStack.init(opts, document.getElementById('grid1'))
.load([{x:0, y:0, content: '0'}, {x:1, y:0, content: '1'}]);
GridStack.init(opts, document.getElementById('grid2'))
.load([{x:0, y:0, content: '2'}, {x:1, y:0, content: '3'}]);
</script>
</body>
</html>
Drag an element in the grid out without letting go of the mouse
Drag it back in (Still without letting go of the mouse)
Move it around the row of the grid and you will see the position is half of what it is supposed to be (In this case, the document has a 0.5 scale)
Expected behavior
If elements are dragged back, they should have the right position
The text was updated successfully, but these errors were encountered:
adumesny
changed the title
[BUG] If acceptWidgets is set to true and transform scaling is applied, dragging elements out of the grid and dragging them back in will result in wrong positions being tracked
[BUG] If transform scaling is applied, dragging out and back in will result in wrong positions being tracked
Mar 30, 2024
Subject of the issue
What the title says. This is a feature that was part of 9.5.0 and there is even a demo here:
https://gridstackjs.com/demo/transform.html#
However, if the grid is set to acceptWidgets from outside, and you drag an element out of the grid then drag it back in (even if it's from the same grid), then the position of the cursor will follow the unscaled grid instead
Your environment
Steps to reproduce
Here is a fiddle of the two vertical grids demo, but with scale(0.5) applied: https://jsfiddle.net/e2t65s1d/
Additionally, you can paste this code yourself if the fiddle does not work for some reason:
Expected behavior
If elements are dragged back, they should have the right position
The text was updated successfully, but these errors were encountered: