etiennepinchon / aframe-rounded

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

Position, alignment of a-rounded #1

Open weddingdj opened 6 years ago

weddingdj commented 6 years ago

A-rounded is positioned, aligned differently than eg. an a-entity.

I changed line https://github.com/etiennepinchon/aframe-rounded/blob/master/dist/aframe-rounded-component.js#L117 : instead of x=0 and y=0 I used x = -this.data.width/2 and y = -this.data.height/2 and it was alright and aligned like other a-entities.

Otherwise, great component!

vincentfretin commented 1 year ago

Thanks @weddingdj , this works great indeed, replacing

roundedRect( roundedRectShape, 0, 0, this.data.width, this.data.height, corners[0], corners[1], corners[2], corners[3] );

by

roundedRect( roundedRectShape, -this.data.width / 2, -this.data.height / 2, this.data.width, this.data.height, corners[0], corners[1], corners[2], corners[3] );