Click here to Skip to main content
16,018,525 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionRecording audio in Unity WebGL game Pin
G. Filkov19-Sep-24 14:13
G. Filkov19-Sep-24 14:13 
Questionimage scrolling Pin
Member 131084951-Sep-24 16:12
Member 131084951-Sep-24 16:12 
AnswerRe: image scrolling Pin
Dave Kreskowiak1-Sep-24 18:27
mveDave Kreskowiak1-Sep-24 18:27 
AnswerRe: image scrolling Pin
RedDk2-Sep-24 9:26
RedDk2-Sep-24 9:26 
AnswerRe: image scrolling Pin
Richard Deeming2-Sep-24 21:11
mveRichard Deeming2-Sep-24 21:11 
GeneralRe: image scrolling Pin
RedDk3-Sep-24 8:04
RedDk3-Sep-24 8:04 
QuestionMapping Touchscreen Events to Mouse Events Pin
Steve Raw17-Aug-24 13:38
professionalSteve Raw17-Aug-24 13:38 
AnswerRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon20-Aug-24 13:02
professionalJeremy Falcon20-Aug-24 13:02 
RantRe: Mapping Touchscreen Events to Mouse Events Pin
Richard Deeming20-Aug-24 18:54
mveRichard Deeming20-Aug-24 18:54 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 4:22
professionalJeremy Falcon21-Aug-24 4:22 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Chris Maunder21-Aug-24 9:41
cofounderChris Maunder21-Aug-24 9:41 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 9:52
professionalJeremy Falcon21-Aug-24 9:52 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Chris Maunder21-Aug-24 9:53
cofounderChris Maunder21-Aug-24 9:53 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 9:57
professionalJeremy Falcon21-Aug-24 9:57 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Steve Raw20-Aug-24 20:49
professionalSteve Raw20-Aug-24 20:49 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 4:39
professionalJeremy Falcon21-Aug-24 4:39 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Steve Raw21-Aug-24 8:22
professionalSteve Raw21-Aug-24 8:22 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 9:48
professionalJeremy Falcon21-Aug-24 9:48 
Steve Raw wrote:
It's so difficult to have a discussion that is so technical. To clarify what you're saying here is that for all mouse-related event listeners, whether inline, or assigned by 'element.addEventListener', I include a function call to the event handler function that handles a touch event?
Maybe some code will help. A fiddle...

Using events as a proxy.

Regardless of whether it's a touch event, click event, pointer event, etc. they can all call dude(). There's no need to add an extra layer of mapping to any of it. This has the benefit of allow the programmer to automate events without having to worry about going through the event cycle, but your real function is all that needs to be called. And it's waaaaay less mentally confusing.
Steve Raw wrote:
I have a few mouse-related event listeners assigned to the window element. I attempted to modify those window event listeners to include a corresponding touch event hander function call. I gave that a try several times in various ways. I quickly realized that using such an approach couldn't work. So, I tried using separate event listeners that handle touch events corresponding to the element's mouse event handler. In theory, that could work, but attempting to implement that would be a huge undertaking, it would be very difficult to maintain and modify. I realized that using such an approach would be like throwing rocks at a hornets nest.
Guess it's my turn not to follow what's being said. Laugh | :laugh:

Just gonna assume we're talking about a click event on window... which should be discouraged. Unless that's like the only event you have and you plan on doing the mapping accordingly. But, if there's one on window plus 1,000 others then that's a different story.

But, the mapping touch basically between the same between mouse, touch, and pointer. The above fiddle also has a touch example. You can use Chrome Dev Tools to simulate the touch for testing it out.

Hope I'm on the right track with understanding the ask.
Jeremy Falcon

GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Steve Raw21-Aug-24 17:24
professionalSteve Raw21-Aug-24 17:24 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon21-Aug-24 17:40
professionalJeremy Falcon21-Aug-24 17:40 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Steve Raw21-Aug-24 17:56
professionalSteve Raw21-Aug-24 17:56 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon22-Aug-24 2:02
professionalJeremy Falcon22-Aug-24 2:02 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon22-Aug-24 2:30
professionalJeremy Falcon22-Aug-24 2:30 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Steve Raw22-Aug-24 4:21
professionalSteve Raw22-Aug-24 4:21 
GeneralRe: Mapping Touchscreen Events to Mouse Events Pin
Jeremy Falcon22-Aug-24 6:44
professionalJeremy Falcon22-Aug-24 6:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.