Commit graph

41 commits

Author SHA1 Message Date
Filip Nedyalkov
4f21e70852 Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.

What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace  DisplayObject

Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.

Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.

Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-21 02:14:10 +03:00
Filip Nedyalkov
483a3b6836 Fix for DisplayObject/DisplayObjectContainer - getting dimensions or bounds do NOT retrieve proper values
* Documentation
* TypeScript Defs
* Nothing, it's a bug fix

Describe the changes below:
I noticed that getting dimensions or bounds changed in Phaser 2.6.1 and
it was bugged - returned dimensions were doubled in the direction of the
scaling for example, but the nice thing was that this time the
dimensions included the rotation of the object - which I think should be
the default behavior. It also bugged getLocalBounds which started
returning global getBounds();
When I checked the previous version of phaser 2.5.0 - total different
story. getLocalBounds returns the object without any transformations to
it. Getting width and height works ok, but rotation wasn't calculated to
the dimensions at all.
In all cases only getBounds returned proper dimensions, which is
obviously not enough and this is also a very important issue to be
resolved as soon as possible since it's a major core component feature
used all the time.
That's why I decided to spare the time and hopefully find a good fix for
all of this mess and I think I finally got there and tried to make the
changes as much as possible with your Code of Conduct. This is actually
the first time I am requesting a pull so I hope it will do some good. I
did compare my results with how Flash handles dimensions - they match,
so I do hope I didn't miss something and believe you guys would make
sure everything works ok.
To help you with reviewing and possibly (and hopefully) accepting this
pull request I've made available online 3 demos of the issues and with
demo of the fix of course:
1.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemo_v2.5.0/
2.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemo_v2.6.1/
3.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemoFixed_v2.6.1/

Here is a zip file of the demo projects (build with VS2015):

http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemos.zip

I really hope to see this FIX in the next version - would help me and a
lot of people I guess to get the job done properly!

Thank you!
2016-07-18 02:32:29 +03:00
Richard Davey
1b4d0330bf TypeScript updates. 2016-07-06 22:19:17 +01:00
Richard Davey
a9976d2703 Phaser 2.5.0 Release. 2016-06-17 12:46:56 +01:00
Richard Davey
43b4fd3caf Fixed defs (#2568) and added in Box2D defs. 2016-06-17 11:52:46 +01:00
photonstorm
694debe94b Rebuilt Phaser Comments TypeScript defs. 2016-06-17 02:28:57 +01:00
photonstorm
2ac594ca03 TypeScript defs update. 2016-06-09 16:29:09 +01:00
pigeonT
93c0cf378f bugfix, in Class Graphics, the method generateTexture should return type RenderTexture, but not current Texture. When use typescript to compile, there is a Error: Type 'Texture' is not assignable to type 'RenderTexture'. 2016-05-29 23:36:18 +02:00
Richard Davey
07e2edc651 Merge pull request #2495 from monagames/ts-colormatrix-filter-fix
Ts colormatrix filter fix
2016-05-23 12:39:22 +01:00
monagames
2fee58fefc Fixed typescript definitions for PIXI ColorMatrixFilter 2016-05-22 09:58:10 +02:00
Thanabodee Charoenpiriyakij
1387aaa055 typescript/pixi.d.ts: Add padding to Graphics.generateTexture 2016-05-21 14:12:37 +07:00
stafford
e6b9ca4e22 fix generateTexture return type 2016-05-12 15:30:33 +10:00
Richard Davey
741cf1e0ed Huge TypeScript defs update (thanks to @clark-stevenson - this is all of the changes from #2156 merged into the current build) 2016-02-02 23:30:03 +00:00
photonstorm
c9c85330ab 2.4.4 Release. 2015-10-15 12:06:38 +01:00
Clark Stevenson
77329e7889 Minor TypeScript definition edits. 2015-08-26 19:07:56 +01:00
Clark Stevenson
8221883c99 Update Definition File 2015-07-17 01:08:45 +01:00
Clark Stevenson
7ac7501a29 Updated TypeScript Definitions 2015-06-23 21:50:27 +01:00
Clark Stevenson
ebd624b8e9 Minor Updates 2015-06-13 17:41:28 +01:00
Clark Stevenson
aff5d1d2c5 Handful of updates to the definition files.
#1812 is fixed. (Note the comments are generated and not updated)
#1803 was fixed previously at some point it seems and required no work
2015-05-25 17:09:22 +01:00
Clark Stevenson
c5396eb39e 2.4.0 Definition Updates. 2015-05-09 02:58:55 +01:00
Clark Stevenson
548e022bc8 Updated typescript package for 2.4.0 2015-04-24 17:16:31 +01:00
Clark Stevenson
aa4ebab29d Update PIXI.d.ts generateTexture
Should fix #1719 ?
2015-04-20 16:27:35 +01:00
Clark Stevenson
cb8a7c467e Pixi Minor change for 2.2.8 2015-03-24 21:38:24 +00:00
Chad Engler
ce254e540e minor typescript def file update 2015-03-24 07:06:14 -07:00
Clark Stevenson
c350d21b0b Minor Updates 2015-03-03 21:15:11 +00:00
Clark Stevenson
7994427583 Weekly Review 2015-02-24 01:22:13 +00:00
photonstorm
4750cc9527 And actually commit it too. 2015-02-23 15:07:22 +00:00
Richard Davey
a672e4adca Merge pull request #1614 from clark-stevenson/dev
Updated to 11 Feb 22:30. Make greater use of Union Types.
2015-02-12 09:40:51 +00:00
Richard Davey
b7eeb977d3 Merge pull request #1617 from Bilge/patch-4
lineColor property is actually numeric.
2015-02-12 09:40:28 +00:00
Bilge
58e7eed05a LineColor property is actually numeric. 2015-02-12 00:49:16 +00:00
Clark Stevenson
2e9728e99f Updated to 11 Feb 22:30. Make greater use of Union Types. 2015-02-11 22:24:47 +00:00
Clark Stevenson
8ed62d740d Update pixi.d.ts
Thanks to @ivw
2015-01-10 02:51:16 +00:00
Tim van den Eijnden
9a4779ac6e updated typescript definitions 2015-01-07 15:08:00 +01:00
Clark Stevenson
428dae564f Fixes #1497 and Minor Updates. 2015-01-02 18:22:11 +00:00
Clark Stevenson
cff41566e0 2.2.0 2014-12-02 13:31:07 +00:00
Clark Stevenson
3c860a4ad5 Definition Updates 2014-11-24 15:53:47 +00:00
Clark Stevenson
1f39f7e3ec Definition Updates 2014-11-18 12:54:07 +00:00
Clark Stevenson
4a4f0deece IPixiShader should be interface and not class 2014-11-16 13:13:07 +00:00
Clark Stevenson
0b399bb1e4 Definition Updates. 2014-11-14 20:16:46 +00:00
Clark Stevenson
1ba17ae086 Pixi updates now includes Spine. Phaser updates. 2014-11-10 21:15:52 +00:00
Clark Stevenson
c3d2b7a90d Split pixi.d.ts and phaser.d.ts 2014-11-05 18:19:45 +00:00