source: imaps-frontend/node_modules/html2canvas/dist/lib/css/layout/bounds.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 2.0 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.parseDocumentSize = exports.parseBounds = exports.Bounds = void 0;
4var Bounds = /** @class */ (function () {
5 function Bounds(left, top, width, height) {
6 this.left = left;
7 this.top = top;
8 this.width = width;
9 this.height = height;
10 }
11 Bounds.prototype.add = function (x, y, w, h) {
12 return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h);
13 };
14 Bounds.fromClientRect = function (context, clientRect) {
15 return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height);
16 };
17 Bounds.fromDOMRectList = function (context, domRectList) {
18 var domRect = Array.from(domRectList).find(function (rect) { return rect.width !== 0; });
19 return domRect
20 ? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height)
21 : Bounds.EMPTY;
22 };
23 Bounds.EMPTY = new Bounds(0, 0, 0, 0);
24 return Bounds;
25}());
26exports.Bounds = Bounds;
27var parseBounds = function (context, node) {
28 return Bounds.fromClientRect(context, node.getBoundingClientRect());
29};
30exports.parseBounds = parseBounds;
31var parseDocumentSize = function (document) {
32 var body = document.body;
33 var documentElement = document.documentElement;
34 if (!body || !documentElement) {
35 throw new Error("Unable to get document size");
36 }
37 var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
38 var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
39 return new Bounds(0, 0, width, height);
40};
41exports.parseDocumentSize = parseDocumentSize;
42//# sourceMappingURL=bounds.js.map
Note: See TracBrowser for help on using the repository browser.