Skip to content

Invalid center coordinates when a point/polygon annotation is configured using x/yMin and y/xMax  #850

@stockiNail

Description

@stockiNail

When a point/polygon annotation is configured using x/yMin and y/xMax, the calculated centerX and centerY are wrong because the center point of result box is used. This is correct only if the box is a square.

return {
x: box.x + options.xAdjust,
y: box.y + options.yAdjust,
x2: box.x + size + options.xAdjust,
y2: box.y + size + options.yAdjust,
centerX: box.centerX + options.xAdjust,
centerY: box.centerY + options.yAdjust,
width: size,
height: size
};

To use the center point of the box, it should be:

    const adjustCenterX = box.centerX + options.xAdjust;
    const adjustCenterY = box.centerY + options.yAdjust;
    return {
      x: adjustCenterX - radius,
      y: adjustCenterY - radius,
      x2: adjustCenterX + radius,
      y2: adjustCenterY + radius,
      centerX: adjustCenterX,
      centerY: adjustCenterY,
      width: size,
      height: size
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions