我似乎在Mozilla博士中找不到对它的任何引用,但是是否存在Rect“类”的公共构造函数?函数采用什么参数?
编辑:似乎试图调用Rect() (不管有没有参数)会导致TypeError: Illegal constructor:http://jsfiddle.net/IQAndreas/a55hG/
发布于 2014-04-09 06:03:51
您所使用的Rect是而不是,它是Mozilla Rect对象。Chrome/Firefox的Rect功能是什么?
Mozilla Rect由模块/几何学提供。
您只能在Components.utils.import("resource://gre/modules/Geometry.jsm", your_scope_obj);之后的火狐扩展中使用它
我不认为你能在jsfiddle env中测试它。
发布于 2014-04-09 05:04:20
构造函数是new Rect(left,top,width,height)
任何较少的参数都会导致许多字段没有被设置。例如:new Rect(1,2,3)将返回一个没有高度的Rect对象
https://stackoverflow.com/questions/22953073
复制相似问题