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 
Steve Raw wrote:
I tried adding touchstart, touchmove, and touchstart at the window level, the document level, body element level, web-window level, and it's too messy.
By proxy I don't mean necessarily adding new events. But, for the events you do handle have them call another function that's the real handler. That way, more than one event can be used for the same handler. It's a lot less messy than trying to map event A to event B.
Steve Raw wrote:
Performance was poor. I have thousands of event handlers, both inline event listeners and added event listeners using the "element.addEventListener" method. Going through each one and adding their corresponding touch event handlers would create a trainwreck of a hackjob; a complete dumpster fire of code. Every idea I have tried, or considered trying doesn't work.
Well, first things first... you need to remove those thousands of event handlers. Bubbling and capturing (trickling) are plenty enough to not need 90% of those I bet. Not sure if you read into bubbling and capturing, but here's a quick summary. In short, bubbling goes up and capturing goes down.

Check out the docs on addEventListener. There's a useCapture parameter. The default bubbles but you can change it to capturing mode via that parameter. Suffice it to say though, events will always propagate (unless canceled in the handler), and that's a good thing as you'll need less of them.

Assuming it's a top level event, bubbling is preferred. If it's a very specific element then capturing may be preferred. But, either way you go, the important thing to do remember is you don't need events on every element. As you discovered it's gonna bring your site to a crawl.
Steve Raw wrote:
It's actually done! I finished it almost an hour ago.
Nice
Steve Raw wrote:
It was as difficult as I had thought. It took 3+ days and about 25 hours in total. 33% was studying, another 33% was experimenting, and I spent 33% of the time testing. It works better than I had ever imagined. Thumbs Up | :thumbsup:
Nice. Isn't web development fun? Laugh | :laugh:
Jeremy Falcon

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 
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.