PDA

View Full Version : Bug with negative positions and getPosition(true)



Terry Smith
1 Aug 2012, 7:40 AM
I recently upgraded to ExtJs 4.1.1. I updated my code that uses getPosition() to the revised api getPosition(true). However, elements that I was positioning with negative coordinates were coming back with 0 as their coordinates. I tracked down the problem to Ext.dom.Element.getLocalX() and getLocalY(). They both use a regular expression "pxRe" to see if the value returned from me.getStyle() can be parsed by parseFloat(). The regex needs to account for a possible negative sign. Adding -? to the beginning of the regex fixed my problem. /^-?\d+(?:\.\d*)?px$/i

My code now works as before with the change of getPosition() to getPosition(true).