Feature proposal: entity clicked detection

A place to request and discuss new engine features / functionality

Feature proposal: entity clicked detection

Postby ChrisEt » Sun Aug 31, 2014 9:08 pm

Hi guys,

it seems that all code out there just reacts to the mouseUp event to determine if an entity has been clicked. This is flawed; the event is also fired if the preceding mouseDown event happened on another entity. Users could eventually "click" the wrong entity.

The reason is that code:
Code: Select all
   _handleMouseUp: function (event, evc, data) {
      // Reset the mouse-down flag
      this._mouseStateDown = false;
      if (this._mouseUp) { this._mouseUp(event, evc, data); }
      
      this.emit('mouseUp', [event, evc, data]);
   },


I'm proposing to add a second event that is depending on _mouseStateDown. Only if this is true we know the mouseDown occurred on the same entity (e.g. UI button), and only then the new 'clicked' event is fired.

What are your thoughts on that?

Thanks in advance,
Christian
ChrisEt
 
Posts: 17
Joined: Thu Oct 24, 2013 8:59 pm

Re: Feature proposal: entity clicked detection

Postby ChrisEt » Mon Sep 01, 2014 7:58 pm

My proposal is to add the following code in IgeEntity.js:

Code: Select all
   _handleMouseUp: function (event, evc, data) {
        // detect clicks (mouseDown and mouseUp on the same entity)
        if (this._mouseStateDown) {
            this.emit('mouseClick', [event, evc, data]);
        }


I committed this in my branch:
https://github.com/coolbloke1324/ige/commit/72f3d74fb4bebcc307791541b54d8c50143ef021
ChrisEt
 
Posts: 17
Joined: Thu Oct 24, 2013 8:59 pm


Return to New Feature Discussion

Who is online

Users browsing this forum: No registered users and 1 guest
cron