mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: bug fix: crash by dropping an HTML element onto the canvas (#3044)
Closes #3043
This commit is contained in:
parent
839cb9a724
commit
3a6aaac5ac
@ -705,14 +705,17 @@ func (u *UserInterface) setCanvasEventHandlers(v js.Value) {
|
||||
func (u *UserInterface) appendDroppedFiles(data js.Value) {
|
||||
u.dropFileM.Lock()
|
||||
defer u.dropFileM.Unlock()
|
||||
|
||||
items := data.Get("items")
|
||||
if items.Length() <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
fs := items.Index(0).Call("webkitGetAsEntry").Get("filesystem").Get("root")
|
||||
u.inputState.DroppedFiles = file.NewFileEntryFS(fs)
|
||||
for i := 0; i < items.Length(); i++ {
|
||||
kind := items.Index(i).Get("kind").String()
|
||||
switch kind {
|
||||
case "file":
|
||||
fs := items.Index(i).Call("webkitGetAsEntry").Get("filesystem").Get("root")
|
||||
u.inputState.DroppedFiles = file.NewFileEntryFS(fs)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (u *UserInterface) forceUpdateOnMinimumFPSMode() {
|
||||
|
Loading…
Reference in New Issue
Block a user