Freckles

mouseup doesn't fire (PIXI)

Recommended Posts

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.

Group 12.jpg

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by ivan.popelyshev

Share this post


Link to post
Share on other sites

@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 by Freckles

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.