-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add useAnimation option to WheelInput #189
Merged
malangfox
merged 7 commits into
naver:master
from
malangfox:feat-wheelinput-useanimation
Jun 13, 2022
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1db2a64
feat: add useAnimation option to WheelInput
malangfox 9f9b02a
fix: remove inappropriate inline functions
malangfox 6a70c89
refactor: change access modifier and name of applyScale
malangfox 144d828
skip: apply reviews
malangfox caaefb3
test: update manual test
malangfox 144429d
chore: set default value of useAnimation to false
malangfox 7c2677f
test: update mouse wheel test
malangfox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,56 @@ | ||
const wrapper = document.getElementById("content"); | ||
const ui0 = document.getElementById("ui0"); | ||
const ui1 = document.getElementById("ui1"); | ||
|
||
const axes0 = new eg.Axes( | ||
{ | ||
zoom: { | ||
range: [1, 4], | ||
}, | ||
}, | ||
{ | ||
minimumDuration: 300, | ||
} | ||
); | ||
|
||
axes0.on({ | ||
change: (e) => { | ||
var pos = e.pos; | ||
|
||
ui0.style[ | ||
eg.Axes.TRANSFORM | ||
] = `translate3d(200px, 200px, 0) scale(${pos.zoom})`; | ||
ui0.innerHTML = `${pos.zoom.toFixed(2)}`; | ||
if (e && e.inputEvent) { | ||
e.inputEvent.__childrenAxesAlreadyChanged = false; | ||
} | ||
}, | ||
}); | ||
|
||
axes0.connect("zoom", new eg.Axes.WheelInput(wrapper)); | ||
axes0.setTo({ zoom: 3 }); | ||
|
||
const axes1 = new eg.Axes( | ||
{ | ||
zoom: { | ||
range: [1, 4], | ||
}, | ||
}, | ||
{ | ||
minimumDuration: 300, | ||
} | ||
); | ||
|
||
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, { 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic mouse users should feel like a magic mouse, and a normal mouse should feel like a magic mouse.
This option will behave strangely for either a Magic Mouse user or a regular mouse.