Freckles Posted June 16, 2020 Share Posted June 16, 2020 Hey guys I have this input fields (they're not finished yet, I use them just for example). When I enter text the cursor goes with it and when I click outside I want to remove the cursor and keep the text obviously. Only mousemove event does the job but that's not suitable in this case. I pass a function that removes the cursor. I tried almost all the events but I don't manage to remove the cursor when I click outside of the input field. Quote Link to comment Share on other sites More sharing options...
Exca Posted June 16, 2020 Share Posted June 16, 2020 Are those standard html input fields with canvas below them? You could make a container that has a hitarea with the size of whole screen and set interactive = true. Then on the handler call blur for the inputfields (or focus for another element, canvas for example). Freckles 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 16, 2020 Share Posted June 16, 2020 (edited) There were events in flash for this, losing focus and stuff.. i dont see focus events in pixi InteractionManager, so you have to add them yourself InteractionManager should fire "blur" event on element if something else was clicked. You can add global click event in InteractionManager (its also EventEmitter) that checks if element is the same as before, and if not it fires event. Anyway, not possible without looking in InteractionManager source. Edited June 16, 2020 by ivan.popelyshev Freckles 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted June 16, 2020 Share Posted June 16, 2020 what about mouseupoutside?https://pixijs.download/dev/docs/PIXI.InteractionManager.html#event:mouseupoutside Are you able to show a basic playground? Freckles 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 16, 2020 Share Posted June 16, 2020 oh, so there's that event I didnt know about it Quote Link to comment Share on other sites More sharing options...
Freckles Posted June 17, 2020 Author Share Posted June 17, 2020 (edited) @jonforum I tried that event as well, but the problem is it's fired just after mousedown so mousedown's callback function doesn't manage to do its job (The file is too big, I can't shorten it to provide a basic playground) I think I will need to go with @Exca's suggestion. I just want to understand how hitarea works. I've read the docs, but I didn't fully understand. I've created input as a module. Do I need to access its parent container from it, which is the app.renderer, or do I create another container in the input module? Thank you all for your help! Edited June 17, 2020 by Freckles Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.