fix swipe issue
This commit is contained in:
parent
c832a51c63
commit
60f767185d
@ -17,6 +17,7 @@
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.instance {
|
||||
overflow-y: scroll;
|
||||
font-size: 8pt;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
@ -45,8 +45,6 @@ function Demo(args) {
|
||||
|
||||
const { combiner, items, equipping, equipped, players } = demo;
|
||||
|
||||
console.log(items);
|
||||
|
||||
const vboxDemo = () => {
|
||||
function inventoryBtn(i, j) {
|
||||
if (!i) return <button disabled class='empty' > </button>;
|
||||
|
||||
@ -76,7 +76,7 @@ class Instance extends Component {
|
||||
}
|
||||
|
||||
return (
|
||||
<main id="instance" class='instance' onClick={instanceClick} onMouseOver={() => setInfo(null)} onTouchMove={onTouchMove}>
|
||||
<main id="instance" class='instance' onClick={instanceClick} onMouseOver={() => setInfo(null)}>
|
||||
<Vbox />
|
||||
<InfoContainer />
|
||||
<InstanceConstructsContainer />
|
||||
@ -85,12 +85,19 @@ class Instance extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.bindSwipes();
|
||||
if (!this.h) this.bindSwipes();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (!this.h) this.bindSwipes();
|
||||
}
|
||||
|
||||
bindSwipes() {
|
||||
const instance = document.getElementById('instance');
|
||||
if (!instance) return setTimeout(this.bindSwipes, 50);
|
||||
if (!instance) {
|
||||
console.log('no instance, binding in 50');
|
||||
return setTimeout(this.bindSwipes, 50);
|
||||
}
|
||||
if (this.h) this.h.destroy();
|
||||
this.h = new Hammer(instance);
|
||||
this.h.on('swiperight', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user