etiennepinchon / aframe-rounded

An A-Frame component to create rectangles with smooth edges.
MIT License
32 stars 10 forks source link

Awesome! But off center #7

Closed dzg closed 1 year ago

dzg commented 1 year ago

This is great, but the center of the plane seems to be in the corner, not the center. So if I want to keep positioning consistent with other entities, I have to shift position by ½ of the width/height. Any way to get the center in the center automatically? Thanks!

dzg commented 1 year ago

I see that function roundedRect starts at x,y then moves around ... I will rework this so the coordinates originate from center and report back.

dzg commented 1 year ago

Got it, just need to add this

      x -= width / 2
      y -= height / 2

right before

      ctx.moveTo(x, y + topLeftRadius)
vincentfretin commented 1 year ago

see also #1