mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 06:24:27 +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) {
|
func (u *UserInterface) appendDroppedFiles(data js.Value) {
|
||||||
u.dropFileM.Lock()
|
u.dropFileM.Lock()
|
||||||
defer u.dropFileM.Unlock()
|
defer u.dropFileM.Unlock()
|
||||||
|
|
||||||
items := data.Get("items")
|
items := data.Get("items")
|
||||||
if items.Length() <= 0 {
|
|
||||||
|
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
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fs := items.Index(0).Call("webkitGetAsEntry").Get("filesystem").Get("root")
|
|
||||||
u.inputState.DroppedFiles = file.NewFileEntryFS(fs)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) forceUpdateOnMinimumFPSMode() {
|
func (u *UserInterface) forceUpdateOnMinimumFPSMode() {
|
||||||
|
Loading…
Reference in New Issue
Block a user