-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add useAnimation option to WheelInput (#189)
* feat: add useAnimation option to WheelInput * fix: remove inappropriate inline functions * refactor: change access modifier and name of applyScale * skip: apply reviews * test: update manual test * chore: set default value of useAnimation to false * test: update mouse wheel test
- Loading branch information
Showing
9 changed files
with
246 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const wrapper = document.getElementById("content"); | ||
const ui0 = document.getElementById("ui0"); | ||
const ui1 = document.getElementById("ui1"); | ||
|
||
const axes0 = new eg.Axes( | ||
{ | ||
zoom: { | ||
range: [1, 4], | ||
}, | ||
}, | ||
{ | ||
deceleration: 0.00002, | ||
} | ||
); | ||
|
||
axes0.on({ | ||
animationStart: (e) => { | ||
if (e && e.inputEvent) { | ||
e.inputEvent.__childrenAxesAlreadyChanged = false; | ||
} | ||
}, | ||
change: (e) => { | ||
var pos = e.pos; | ||
|
||
ui0.style[ | ||
eg.Axes.TRANSFORM | ||
] = `translate3d(200px, 200px, 0) scale(${pos.zoom})`; | ||
ui0.innerHTML = `${pos.zoom.toFixed(2)}`; | ||
}, | ||
}); | ||
|
||
axes0.connect( | ||
"zoom", | ||
new eg.Axes.WheelInput(wrapper, { | ||
scale: 1 / 1000, | ||
useNormalized: false, | ||
useAnimation: true, | ||
}) | ||
); | ||
axes0.setTo({ zoom: 3 }); | ||
|
||
const axes1 = new eg.Axes({ | ||
zoom: { | ||
range: [1, 4], | ||
}, | ||
}); | ||
|
||
axes1.on({ | ||
change: (e) => { | ||
var pos = e.pos; | ||
|
||
ui1.style[ | ||
eg.Axes.TRANSFORM | ||
] = `translate3d(200px, 200px, 0) scale(${pos.zoom})`; | ||
ui1.innerHTML = `${pos.zoom.toFixed(2)}`; | ||
}, | ||
}); | ||
|
||
axes1.connect( | ||
"zoom", | ||
new eg.Axes.WheelInput(wrapper, { | ||
scale: 1 / 1000, | ||
useNormalized: false, | ||
useAnimation: false, | ||
}) | ||
); | ||
axes1.setTo({ zoom: 3 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>egjs-axes</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no"> | ||
<style> | ||
.content { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.uiWrapper { | ||
overflow: hidden; | ||
position: relative; | ||
width: 400px; | ||
height: 400px; | ||
background-color: #eebf3f; | ||
border-radius: 5px; | ||
margin-bottom: 20px; | ||
box-shadow: 0px 1px 2px #8c532e; | ||
float: left; | ||
} | ||
|
||
.uiWrapper .ui { | ||
width: 100px; | ||
height: 100px; | ||
left: -50px; | ||
top: -50px; | ||
position: absolute; | ||
background-color: black; | ||
color: white; | ||
border-radius: 50px; | ||
line-height: 100px; | ||
text-align: center; | ||
} | ||
|
||
.uiWrapper .ui img { | ||
width: 45px; | ||
height: 75px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h1>Pan Input</h1> | ||
<div id="content" class="content"> | ||
<div> | ||
<h3>UseAnimation: true</h3> | ||
<div id="delegateTarget0"> | ||
<div id="uiWrapper" class="uiWrapper"> | ||
<div id="ui0" class="ui"> | ||
3.0 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<h3>UseAnimation: false</h3> | ||
<div id="delegateTarget1"> | ||
<div id="uiWrapper" class="uiWrapper"> | ||
<div id="ui1" class="ui"> | ||
3.0 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="../../dist/axes.pkgd.js"></script> | ||
<script src="js/wheel.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters