Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
map((country) => {
const tile = new DejaTile();
tile.percentBounds = new Rect(x1, y1, 15, 15);
tile.color = country.color;
tile.templateModel = country;
x1 += 15;
if (x1 + 15 > 100) {
x1 = 0;
y1 += 15;
}
// Map for drag and drop
this.countriesMap.set(tile.id, country);
return tile;
}),
reduce((acc: DejaTile[], cur: DejaTile) => [...acc, cur], []));
map((country) => {
const tile = new DejaTile();
tile.percentBounds = new Rect(x2, y2, 15, 15);
tile.color = country.color;
tile.templateModel = country;
x2 += 15;
if (x2 + 15 > 100) {
x2 = 0;
y2 += 15;
}
return tile;
}),
reduce((acc: DejaTile[], cur: DejaTile) => [...acc, cur], []));
dragStart: (target) => {
const country = this.countriesMap.get(target.id);
const tile = new DejaTile();
tile.percentBounds = new Rect(0, 0, 15, 15);
tile.color = country.color;
tile.templateModel = country;
return {
country: country,
DejaTile: tile,
};
},
} as IDejaMouseDraggableContext;