Html5 Canvas - Positioning elements (scale)

0

Good afternoon, I'm developing a canvas system and I have some problems when I scale and drag components. The calculations I am making are. Positioning of the element at the origin:  - xElement / pointXClick  - yElement / dotYClick

The width and height ratio multiplies by the scale (widthElement * scale, heightElement * scale). This works correctly if the x-axis and the y-axis are positive but sometimes I'm drawing in negative -, - +, + - positions. Does anyone know of any trick or magic formula to not have these kind of problems, so you can draw in any quadrant correctly?

    
asked by anonymous 31.08.2018 / 17:00

0 answers