Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebGL Tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiyoung Moon
WebGL Tutorial
Commits
92517f59
Commit
92517f59
authored
4 years ago
by
Jiyoung Moon
Browse files
Options
Downloads
Patches
Plain Diff
Update script.js
parent
2ef6591d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
script.js
+7
-29
7 additions, 29 deletions
script.js
with
7 additions
and
29 deletions
script.js
+
7
−
29
View file @
92517f59
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
);
//////
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment