Comments (6)
Found The issue:
there is race condition in JS part (try access canvas before it exists):
ebitenui/internal/jsUtil/util_js.go
Line 35 in 42a4595
To fix it wrap that part with requestAnimationFrame:
requestAnimationFrame := js.Global().Get("requestAnimationFrame")
requestAnimationFrame.Invoke(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
//Get the canvas and attach an event listener for screen touches
canvas := document.Get("body").Call("getElementsByTagName", "canvas").Index(0)
offsetTop = canvas.Get("offsetTop").Int()
canvas.Call("addEventListener", "touchstart", js.FuncOf(handleClick), false)
canvas.Call("addEventListener", "touchend", js.FuncOf(handleClick), false)
return nil
}))
from ebitenui.
It looks like I have the same issue.
ebitenui + go1.21 doesn't work in wasm.
ebitenui + go1.20 does work.
from ebitenui.
from ebitenui.
need PR?
from ebitenui.
Related Issues (20)
- Issue pre-selecting entry in middle of combo box with multiple pages of entries
- CursorUpdater: how to set back to default?
- CursorUpdater: a cursor disappears with nil replacement images HOT 4
- Rendering on an image that is not the entire screen get button events on the wrong place HOT 3
- SVG Vector Option in Widgets HOT 3
- TextInput rendering two characters per keystroke HOT 1
- Text centering issues with bitmapfont HOT 16
- How to update text when var changes HOT 5
- Editable Text Area. HOT 1
- Text input cursor is not at the end when text is updated through the code HOT 2
- TabBook: disabling the 1st tab works unexpectedly HOT 3
- AnchorLayout only shows a single child. HOT 6
- Android: Focusing a Text Input does not open Android on screen keyboard HOT 5
- Text Area does not render text on mobile HOT 1
- Consider an ebitengine version decrease in the go.mod file HOT 1
- Centering a button HOT 2
- Cannot set button text position to TextPositionEnd HOT 3
- Broken ContextMenu HOT 2
- Support percentage widths on gridlayout
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ebitenui.