Truncate angles

This commit is contained in:
Devine Lu Linvega 2019-08-02 16:45:47 +09:00
parent 2944bc4d1d
commit 0f04ed8628

View File

@ -158,19 +158,19 @@ function Ronin () {
h: size.h h: size.h
} }
const wh = rect.w + ' ' + rect.h const wh = rect.w + ' ' + rect.h
const d = Math.sqrt(((line.a.x - line.b.x) * (line.a.x - line.b.x)) + ((line.a.y - line.b.y) * (line.a.y - line.b.y))) const d = Math.sqrt(((line.a.x - line.b.x) * (line.a.x - line.b.x)) + ((line.a.y - line.b.y) * (line.a.y - line.b.y))).toFixed(2)
const a = Math.atan2(pos.y - line.a.y, pos.x - line.a.x) const a = Math.atan2(pos.y - line.a.y, pos.x - line.a.x).toFixed(2)
const circle = { const circle = {
cx: line.a.x, cx: line.a.x,
cy: line.a.y, cy: line.a.y,
r: d.toFixed(2) r: d
} }
const arc = { const arc = {
cx: line.a.x, cx: line.a.x,
cy: line.a.y, cy: line.a.y,
r: d.toFixed(2), r: d,
sa: 0, sa: 0,
ea: a.toFixed(2) ea: a
} }
return { x, y, xy, wh, d, a, line, rect, pos, size, circle, arc, type, 'is-down': type !== 'mouse-up' ? true : null } return { x, y, xy, wh, d, a, line, rect, pos, size, circle, arc, type, 'is-down': type !== 'mouse-up' ? true : null }
} }