PDA

View Full Version : Snap to grid positioning for a window



zz9pa
5 Dec 2019, 8:48 AM
Hi
I've got a set of window that are constrained to a panel - and I can move them about without any issues.

I can set

resizable: {
target: this,
handles: 'all',
dynamic: true,
heightIncrement:50,
widthIncrement: 50
},

on the window - and it will only resize in chunks of 50 pixels

What I'd really like is to limit where the window can be dropped so it sits on that same 50x50 grid.

I thought I could do it with something like

draggable: {
constrain: {
snap: {
x: me.snapToGrid,
y: me.snapToGrid
}
}
}

but that doesn't seem to be available to a Window.
I've tried various ways of doing it in the "move" event handler - but I'm having issues with the "Y" position (not relative to the panel maybe?)


Any thoughts on how I can get the window to "snap" move as well as resize ?

zz9pa
12 Dec 2019, 2:13 AM
Does anyone at Sencha actually monitor these forums ?

evant
12 Dec 2019, 3:32 AM
No: https://www.sencha.com/blog/sencha-on-stack-overflow/

zz9pa
12 Dec 2019, 4:57 AM
No: https://www.sencha.com/blog/sencha-on-stack-overflow/


"Effective Jan 1, 2020"