fabricjs에서 Polygon좌표를 절대값으로 변환하기

catch me if u can!·2021년 3월 5일
0

Fabric.js is a powerful and simple Javascript HTML5 canvas library
Fabric.js demos · Custom controls, polygon

Custom controls, polygon 예제에서 Polygon으로 변환된 개체의 절대좌표를 계산한다.

//
//
//canvas = new fabric.Canvas("canvas");
//convertAbsolutePoint(canvas.getActiveObject());
function convertAbsolutePoint(area) {
  return area.points
  .map(p=>fabric.util.transformPoint({ x:p.x - area.pathOffset.x, y:p.y - area.pathOffset.y }, area.calcTransformMatrix()));    
}
profile
마쿠투소케 난쿠로나이사

0개의 댓글