Jump to content

not sure how to commit a fix


InsaneHero
 Share

Recommended Posts

I just tried to push a fix but the system rejected it because I don't have permissions.  I was probably pushing to the master branch or something dumb but I'm too tired now to work it out.

Here's the change in case someone else wants to take care of it?  If not I'll take another look tomorrow when I'm more awake...

 

Input.js

 

hitTest

 

819:             if (this._localPoint.x >= x1 && this._localPoint.x < x1 + width)

839:                if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height)
 
In both cases I simply added the "=" to the comparison because currently tiled sprites (both "TileSprite" and "Sprite" which happen to be tiled) will fail input checks when the cursor is exactly on the edge between them (all tiles will say the cursor is not within them and events will fall through the gap to whatever is underneath).
 
I notice that Rectangle.contains is using >= AND <= too which includes both edges.  One or the other is wrong because boundary checking should be consistent and tiled adjacent sprites should not have invisible gaps between them.
 
I prefer to only include left and top edges because it avoids overlap conflicts, but that's just long habit on my part and not based on any serious thought.
Link to comment
Share on other sites

You have to fork the phaser repo. Then you'll have your own copy of it you can edit. Make your changes locally (to your fork), commit them and then go onto github and hit "pull request". This will allow us to merge your changes into the core of phaser. Be sure you only do this against the dev branch though (so after forking phaser, swap to the dev branch locally, then make all changes these).

 

Failing that you could raise it as an issue on github and we'll make the fixes manually.

Link to comment
Share on other sites

I made a pete/dev branch, but when I hit 'publish' it eventually comes back with "error Failed to publish this branch."

There are no details provided, any ideas?

I'd raise it as an issue on github but right now I'm not willing to be infuriated by more bad UI design from the google team (I just wasted most of a day publishing a game into the Play store... I'm sure it'll be easy next time, but the first time approaching any Google product just leaves me going "what?!!  WHY!!?").

 

Here's the diff from github for windows:

 

 @@ -816,11 +816,11 @@ Phaser.Input.prototype = {
            var height = displayObject.height;
            var x1 = -width * displayObject.anchor.x;

-            if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
+            if (this._localPoint.x >= x1 && this._localPoint.x < x1 + width)
            {
                var y1 = -height * displayObject.anchor.y;

-                if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
+                if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height)
                {
                    return true;
                }
@@ -832,11 +832,11 @@ Phaser.Input.prototype = {
            var height = displayObject.texture.frame.height;
            var x1 = -width * displayObject.anchor.x;

-           if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
+          if (this._localPoint.x >= x1 && this._localPoint.x < x1 + width)
            {
                var y1 = -height * displayObject.anchor.y;

-               if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
+              if (this._localPoint.y >= y1 && this._localPoint.y < y1 + height)
                {
                    return true;
                }

Link to comment
Share on other sites

Ok the Input.hitTest fix is now merged in. Also I updated Rectangle, does the following look better to you?

Phaser.Rectangle.contains = function (a, x, y) {    if (a.width <= 0 || a.height <= 0)    {        return false;    }    return (x >= a.x && x < a.right && y >= a.y && y < a.bottom);};Phaser.Rectangle.containsRaw = function (rx, ry, rw, rh, x, y) {    return (x >= rx && x < (rx + rw) && y >= ry && y < (ry + rh));};Phaser.Rectangle.containsRect = function (a, B) {    //  If the given rect has a larger volume than this one then it can never contain it    if (a.volume > b.volume)    {        return false;    }    return (a.x >= b.x && a.y >= b.y && a.right < b.right && a.bottom < b.bottom);};
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...