Не могу понять, почему существует дифференциальное смещение Result. Полигоны и текст смещены равномерно, линейные относительные ошибки полигонов сдвинуты.KineticJS смены координат для объектов
function setNewPosition(x, y) {
var lines = stage.find('Line');
if (lines.length > 0) {
lines.forEach(function inLines(line) {
var points = line.getPoints();
if (points.length > 0) {
points.forEach(function pSet(p) {
p.x += x;
p.y += y;
});
}
});
};
polygons = stage.find('Polygon');
if (polygons.length > 0) {
polygons.forEach(function inPoly(polygon) {
var points = polygon.getPoints();
if (points.length > 0) {
points.forEach(function pSet(p) {
p.x += x;
p.y += y;
});
}
});
};
texts = stage.find('Text');
if (texts.length > 0)
texts.forEach(function inText(text) {
oX = text.getX();
oY = text.getY();
text.setX(oX + x);
text.setY(oY + y);
}
);
layer.draw();
}
_offtopic: этот код может получить некоторый refactoring_;) – c69