-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add preventDefaultOnDrag option to PanInput (#214)
* feat: add preventDefaultOnDrag option to PanInput * test: add dispatchDrag to test util * test: add flick manual test * docs: add preventDefaultOnDrag demo * docs: update preventDefaultOnDrag demo * demo: add clickable link to preventDefaultOnDrag demo * demo: update demos * demo: fix logo demo color in dark mode * demo: fix demo deploy paths * fix: fix preventDefaultOnDrag affecting touchstart
- Loading branch information
Showing
16 changed files
with
273 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
{ | ||
"basePath": "packages/axes/dist", | ||
"dists": [ | ||
"demo/dist" | ||
"packages/demo/dist" | ||
] | ||
} | ||
], | ||
|
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,75 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>egjs-axes</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no"> | ||
<style> | ||
.viewport { | ||
overflow: hidden; | ||
} | ||
.camera { | ||
display: flex; | ||
} | ||
.panel { | ||
padding: 0 10px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="viewport"> | ||
<div class="camera"> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/110010/fff&text=1" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/220020/fff&text=2" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/330030/fff&text=3" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/440040/fff&text=4" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/550050/fff&text=5" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/660060/fff&text=6" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/770070/fff&text=7" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/880080/fff&text=8" | ||
/> | ||
</div> | ||
<div class="panel"> | ||
<img | ||
src="https://dummyimage.com/300x300/990090/fff&text=9" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="../../../../node_modules/@egjs/component/dist/component.js"></script> | ||
<script src="../../dist/axes.pkgd.js"></script> | ||
<!-- <script src="../../dist/axes.pkgd.js"></script> --> | ||
<script src="js/flick.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var viewport = document.querySelector(".viewport"); | ||
var camera = document.querySelector(".camera"); | ||
var input = new eg.Axes.PanInput(viewport, { | ||
scale: [1, 1], | ||
inputType: ["touch", "mouse"], | ||
preventClickOnDrag: true, | ||
preventDefaultOnDrag: true, | ||
}); | ||
var axes = new eg.Axes( | ||
{ | ||
x: { | ||
range: [-1000, 0], | ||
startPos: 0, | ||
}, | ||
}, | ||
).on("change", function (e) { | ||
camera.style.transform = "translateX(" + e.pos.x + "px)"; | ||
}); | ||
|
||
axes.connect(["x"], input); |
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 |
---|---|---|
|
@@ -28,3 +28,8 @@ | |
cursor: pointer; | ||
margin-top: -15px; | ||
} | ||
|
||
.link { | ||
position: absolute; | ||
top: -40px; | ||
} |
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
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
Oops, something went wrong.