Skip to content

Commit

Permalink
Toggle for horizontal/vertical line segments (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Jul 6, 2020
1 parent 9e0da26 commit d3b0538
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,19 @@ tools =
delete pointers[e.pointerId]
move: (e) ->
return unless pointers[e.pointerId]
pt = eventToPoint e
## Force horizontal/vertical line when holding shift
if e.shiftKey
start = Objects.findOne(pointers[e.pointerId]).pts[0]
dx = Math.abs pt.x - start.x
dy = Math.abs pt.y - start.y
if dx > dy
pt.y = start.y
else
pt.x = start.x
pointers.throttle
id: pointers[e.pointerId]
pts: 1: eventToPoint e
pts: 1: pt
rect:
icon: 'rect'
hotspot: [0.0625, 0.883]
Expand Down

0 comments on commit d3b0538

Please sign in to comment.