vue-cesium
Version:
Vue 3.x components for CesiumJS.
41 lines (37 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
;
let isExtended = false;
class RectangleExtend {
static extend(viewer) {
if (isExtended) {
return;
}
const { Rectangle } = Cesium;
Rectangle.prototype.expand = function(widthFactor, heightFactor, result) {
result = result && result instanceof Rectangle ? result : this.clone();
widthFactor = result.width * (1 - widthFactor) / 2;
heightFactor = result.height * (1 - heightFactor) / 2;
result.west += widthFactor;
result.south += heightFactor;
result.east -= widthFactor;
result.north -= heightFactor;
result.west = result.west < -Math.PI ? -Math.PI : result.west;
result.east = result.east > Math.PI ? Math.PI : result.east;
result.north = result.north > Math.PI / 2 ? Math.PI / 2 : result.north;
result.south = result.south < -Math.PI / 2 ? -Math.PI / 2 : result.south;
return result;
};
isExtended = true;
}
static revoke(viewer) {
if (!isExtended) {
return;
}
const { Rectangle } = Cesium;
Rectangle.prototype.expand = void 0;
isExtended = false;
}
}
exports["default"] = RectangleExtend;
//# sourceMappingURL=RectangleExtend.js.map