-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(joystick): add lockX and lockY options
- Loading branch information
1 parent
2c541a6
commit 6baba97
Showing
8 changed files
with
176 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
], | ||
"license": "MIT", | ||
"dependencies": {} | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,61 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>NippleJS</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5"> | ||
<style> | ||
html, body { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
#left { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
height: 100%; | ||
width: 50%; | ||
background: rgba(0, 255, 0, 0.1); | ||
} | ||
|
||
#right { | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
height: 100%; | ||
width: 50%; | ||
background: rgba(0, 0, 255, 0.1); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="left"></div> | ||
<div id="right"></div> | ||
<script src="../dist/nipplejs.js" charset="utf-8"></script> | ||
<script> | ||
var joystickL = nipplejs.create({ | ||
zone: document.getElementById('left'), | ||
mode: 'static', | ||
position: { left: '20%', top: '50%' }, | ||
color: 'green', | ||
size: 200, | ||
lockX: true | ||
}); | ||
|
||
var joystickR = nipplejs.create({ | ||
zone: document.getElementById('right'), | ||
mode: 'static', | ||
position: { left: '80%', top: '50%' }, | ||
color: 'red', | ||
size: 200, | ||
lockY: true | ||
}); | ||
</script> | ||
</body> | ||
</html> |