Open yanislavgalyov opened 9 months ago
Ok, I fixed it by changing code in test.js from:
class CustomHex extends defineHex() {
static create(coordinates, _key) {
const hex = new CustomHex(coordinates);
hex._key = _key;
return hex;
}
}
to
class CustomHex extends defineHex({
dimensions: { width: 32, height: 32 },
orientation: Orientation.FLAT,
origin: 'topLeft',
offset: -1,
}) {
static create(coordinates, _key,) {
const hex = new CustomHex(coordinates);
hex._key = _key;
return hex;
}
}
But this seems counterintuitive for me as those settings must be set from the json.
Thanks for opening an issue. I'll try to get back to you in a week.
Describe the bug I am encountering an issue when initializing a grid from JSON using the fromJSON method. The problem arises when I use a hexFactory to map custom properties to the hexes in the grid. This results in the hexes having unusual property values. I am working in JavaScript and have adapted your examples to this language.
To Reproduce
I have omitted
honeycomb-grid
imports for brevity.map.json
test.js
Additional context The data in map.json were obtained from the following code, with the _key property added subsequently.
original.js
Environment (please complete the following information):
Expected behavior vs Actual result Normally, when I do not attempt to customize the hex, everything functions correctly. However, when I try to customize it, many of the Hex property values become corrupted, leading to the grid not rendering properly.