From 92517f59b7ffed0ba4562eac55dbffe07ec46c5d Mon Sep 17 00:00:00 2001 From: Jiyoung Moon <koo05249@ajou.ac.kr> Date: Sat, 27 Jun 2020 15:56:58 +0900 Subject: [PATCH] Update script.js --- script.js | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/script.js b/script.js index 17facd3..aff3b87 100644 --- a/script.js +++ b/script.js @@ -1,25 +1,3 @@ -MIT License - -Copyright (c) 2020 Jiyoung Moon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - var gl; var shaderProgram; @@ -37,7 +15,6 @@ function initialStep(canvas) { catch (e) { } - ////// new code! var drag=false; var original_x, original_y; @@ -45,10 +22,10 @@ function initialStep(canvas) { var Downward=function(e) { drag=true; - original_x=e.pageX, original_y=e.pageY; + original_x = e.pageX; + original_y = e.pageY; e.preventDefault(); - return false; }; var Upward=function(e){ @@ -56,13 +33,14 @@ function initialStep(canvas) { }; var Moving=function(e) { - if (drag==false) return false; + if (!drag) return false; var gap_x = e.pageX - original_x; var gap_y = e.pageY - original_y; - y_rad += gap_x*2*Math.PI/canvas.width; - x_rad += gap_y*2*Math.PI/canvas.height; + y_rad += gap_x*3/canvas.width; + x_rad += gap_y*3/canvas.height; + original_x = e.pageX; original_y = e.pageY; @@ -71,8 +49,8 @@ function initialStep(canvas) { canvas.addEventListener("mousedown", Downward, false); canvas.addEventListener("mouseup", Upward, false); + canvas.addEventListener("mouseout", Upward, false); canvas.addEventListener("mousemove", Moving, false); - ////// } -- GitLab