Skip to content

Touch screen fix #90

@Bluecat-1st

Description

@Bluecat-1st

When ever I use the touchscreen on the sdl window, it would always crash, and I found that in src/javascript/events/index.js, for the touch case, it determines the device variable using Globals.touchState, but when I looked through the code, Globals.touchState is not found anywhere, but when I tried using Globals.touchDevices, it did not crash and it seemed to work properly.

Here is my fixed version for the touch case:

		case 'touch': {
			const { touchId } = event
			delete event.touchId

			let device = Globals.touchDevices.find(({ id }) => id === touchId)
			if (device === undefined) {
				Globals.touchDevices = Bindings.touch_getDevices()
				device = Globals.touchDevices.find(({ id }) => id === touchId)
			}

			const { windowId } = event
			delete event.windowId

			const window = Globals.windows.all.get(windowId)
			if (!window) { return }

			event.device = device
			window.emit(type, event)
		} break

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions