Skip to content
Snippets Groups Projects
Commit 83e8c97f authored by Julian's avatar Julian
Browse files

Don't allow items outside grid

parent 6e943df7
No related branches found
No related tags found
1 merge request!2Resolve "Implement basic functionality"
...@@ -44,6 +44,10 @@ export default { ...@@ -44,6 +44,10 @@ export default {
}, },
methods: { methods: {
positionAllowed(x, y, key) { positionAllowed(x, y, key) {
if (x < 0 || y < 0) return false;
if (x > this.cols) return false;
if (y > this.rows) return false;
for (let item of this.items) { for (let item of this.items) {
if (key === item.key) continue; if (key === item.key) continue;
if (x >= item.x && x < item.x + item.w) { if (x >= item.x && x < item.x + item.w) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment