From d2361bc4447378ea3a0740e15164e18d2d8605be Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 26 Jun 2021 11:47:44 -0500 Subject: [PATCH] Fixed issues with gridables proxy --- src/store/layers.js | 2 +- src/store/proxies.js | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/store/layers.js b/src/store/layers.js index e9869d4..486bd94 100644 --- a/src/store/layers.js +++ b/src/store/layers.js @@ -345,7 +345,7 @@ export function addLayer(layer, player = null) { if (layer.grids[id].getStartData == undefined) { layer.grids[id].getStartData = ""; } - layer.grids[id].data = function(cell) { + layer.grids[id].getData = function(cell) { if (player[layer.id].grids[id][cell] != undefined) { return player[layer.id].grids[id][cell]; } diff --git a/src/store/proxies.js b/src/store/proxies.js index bd9466c..4137ae1 100644 --- a/src/store/proxies.js +++ b/src/store/proxies.js @@ -158,12 +158,12 @@ function getGridHandler(prefix) { } else if (isFunction(target[key])) { const getterID = `${prefix}${key}`; if (getterID in store.getters) { - return store.getters[getterID](); + return store.getters[getterID]; } else { return target[key].bind(receiver); } } - if (!isNaN(key)) { + if (typeof key !== 'symbol' && !isNaN(key)) { target[key] = new Proxy(target, getCellHandler(key)); } return target[key]; @@ -187,9 +187,7 @@ function getCellHandler(id) { } let prop = target[key]; - if (isFunction(prop)) { - return prop.call(receiver, id, target.data(id)); - } else if (prop != undefined) { + if (prop != undefined) { return prop; } @@ -200,14 +198,14 @@ function getCellHandler(id) { key = key.slice(0, 1).toUpperCase() + key.slice(1); prop = target[`get${key}`]; if (isFunction(prop)) { - return prop.call(receiver, id, target.data(id)); + return prop.call(receiver, id, target.getData(id)); } else if (prop != undefined) { return prop; } prop = target[`on${key}`]; if (isFunction(prop)) { - return () => prop.call(receiver, id, target.data(id)); + return () => prop.call(receiver, id, target.getData(id)); } else if (prop != undefined) { return prop; }