报告一个Cocos2d-js v3.12的bug!

CCEGLView.js中_convertTouchesWithScale函数

_convertTouchesWithScale: function(touches){
        var locViewPortRect = this._viewPortRect, locScaleX = this._scaleX, locScaleY = this._scaleY,
            selTouch, selPoint, selPrePoint, selStartPoint;
        for( var i = 0; i < touches.length; i ++){
            selTouch = touches[i];
            selPoint = selTouch._point;
            selPrePoint = selTouch._prevPoint;
            selStartPoint = selTouch._startPoint;

            selPoint.x = (selPoint.x - locViewPortRect.x) / locScaleX;
            selPoint.y = (selPoint.y - locViewPortRect.y) / locScaleY;
            selPrePoint.x = (selPrePoint.x - locViewPortRect.x) / locScaleX;
            selPrePoint.y = (selPrePoint.y - locViewPortRect.y) / locScaleY;
            selStartPoint.x = (selStartPoint.x - locViewPortRect.x) / locScaleX;
            selStartPoint.y = (selStartPoint.y - locViewPortRect.y) / locScaleY;
        }
    }

这里的selStartPoint实际是selTouch._startPoint的引用,
但似乎:
selStartPoint.x = (selStartPoint.x - locViewPortRect.x) / locScaleX;
selStartPoint.y = (selStartPoint.y - locViewPortRect.y) / locScaleY;
这两行不应该去执行, 这里执行后会导致touch._startPoint发生改变, 从而导致_startPoint会不断的变化成错误的值, 从而导致依赖startPoint的代码出现错误, 从逻辑上_startPoint是应该一旦在CCTouch.js中的setTouchInfo函数中确定下来, 就不应该再改变的.

1赞

感谢反馈,我今天会确认下

感谢反馈,这个问题已经修复,可以帮忙 review 一下

https://github.com/cocos2d/cocos2d-html5/pull/3345