forked from profectus/Profectus
Fixed issues with gridables proxy
This commit is contained in:
parent
273b9e0118
commit
d2361bc444
2 changed files with 6 additions and 8 deletions
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue