From 0bc1a9aac6bf2f7a894ee4723803865cb1af9e10 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 18 Apr 2011 18:12:00 +0200 Subject: [PATCH] Simplify BezierTool example. --- examples/Tools/BezierTool.html | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/examples/Tools/BezierTool.html b/examples/Tools/BezierTool.html index 97c0eb86..2caeccaf 100644 --- a/examples/Tools/BezierTool.html +++ b/examples/Tools/BezierTool.html @@ -59,20 +59,14 @@ } function onMouseDrag(event) { - if (mode == 'move') { - if (type == 'point') { - currentSegment.point = event.point; - } else { - var delta = event.delta.clone(); - if (type == 'handleOut') - delta = -delta; - currentSegment.handleIn += delta; - currentSegment.handleOut -= delta; - } - } else if (mode == 'add') { - var delta = event.point - event.downPoint; - currentSegment.handleOut = delta; - currentSegment.handleIn = -delta; + if (mode == 'move' && type == 'point') { + currentSegment.point = event.point; + } else if (mode != 'close') { + var delta = event.delta.clone(); + if (type == 'handleOut' || mode == 'add') + delta = -delta; + currentSegment.handleIn += delta; + currentSegment.handleOut -= delta; } }