From 83e8c97f068c9e4c43f6f30daaa87af696ac208a Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Tue, 7 Feb 2023 12:47:16 +0100 Subject: [PATCH] Don't allow items outside grid --- src/Grid.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Grid.vue b/src/Grid.vue index 8b9d4cd..f5cdbe4 100644 --- a/src/Grid.vue +++ b/src/Grid.vue @@ -44,6 +44,10 @@ export default { }, methods: { 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) { if (key === item.key) continue; if (x >= item.x && x < item.x + item.w) { -- GitLab