MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / scale

Method scale

src/common/commontypes/Bounds.js:264–287  ·  view source on GitHub ↗

* @function Bounds.prototype.scale * @description 按照比例扩大/缩小出一个新的 bounds。 * @example * var bounds = new Bounds(-50,-50,40,40); * var bounds2 = bounds.scale(2); * @param {number} [ratio=1] - 需要扩大的比例。 * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。 * @

(ratio, origin)

Source from the content-addressed store, hash-verified

262 * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
263 */
264 scale(ratio, origin) {
265 ratio = ratio ? ratio : 1;
266 if (origin == null) {
267 origin = this.getCenterLonLat();
268 }
269
270 var origx, origy;
271
272 // get origin coordinates
273 if (origin.CLASS_NAME === "SuperMap.LonLat") {
274 origx = origin.lon;
275 origy = origin.lat;
276 } else {
277 origx = origin.x;
278 origy = origin.y;
279 }
280
281 var left = (this.left - origx) * ratio + origx;
282 var bottom = (this.bottom - origy) * ratio + origy;
283 var right = (this.right - origx) * ratio + origx;
284 var top = (this.top - origy) * ratio + origy;
285
286 return new Bounds(left, bottom, right, top);
287 }
288
289 /**
290 * @function Bounds.prototype.add

Callers 15

NonEarthCRSSpec.jsFile · 0.45
BoundsSpec.jsFile · 0.45
MatrixSpec.jsFile · 0.45
VectorSpec.jsFile · 0.45
constructorMethod · 0.45
Base.jsFile · 0.45
MapVLayer.jsFile · 0.45
BFunction · 0.45
JtFunction · 0.45
QtFunction · 0.45
mapbox-gl.jsFile · 0.45

Calls 1

getCenterLonLatMethod · 0.95

Tested by

no test coverage detected