From 1588dd5f5d40c209d223fd7911af5c033991249a Mon Sep 17 00:00:00 2001 From: Mihai Varga Date: Thu, 15 Oct 2015 19:17:18 +0300 Subject: [PATCH] loleaflet: map.getPageSizes - returns the size of each page In twips and pixels --- loleaflet/README | 2 ++ loleaflet/reference.html | 6 ++++++ loleaflet/src/control/Parts.js | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/loleaflet/README b/loleaflet/README index f961c7977..24123a75a 100644 --- a/loleaflet/README +++ b/loleaflet/README @@ -203,6 +203,8 @@ Writer pages: + options = {autoUpdate: true} - automatically updates the previews map.removePreviewUpdate(id) + id = the preview's id + map.getPageSizes() + + returns {twips: [Bounds], pixels: [Bounds]} - events map.on('pagenumberchanged', function (e) {}) where: diff --git a/loleaflet/reference.html b/loleaflet/reference.html index 59a56053b..2d792238d 100644 --- a/loleaflet/reference.html +++ b/loleaflet/reference.html @@ -1422,6 +1422,12 @@ var map = L.map('map', { Returns the document type. + getPageSizes() + {twips: [Bounds],
+ pixels: [Bounds]}
+ Returns an object describing the size of each page in twips and pixels. + + scroll( <Number>x, <Number>y, diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js index f1019955f..88585bf73 100644 --- a/loleaflet/src/control/Parts.js +++ b/loleaflet/src/control/Parts.js @@ -164,11 +164,10 @@ L.Map.include({ return this._docLayer._docPixelSize; }, - getPageSize: function (page) { - if (this._docLayer._partPageRectanglesPixels && this._docLayer._partPageRectanglesPixels.length > page) { - return this._docLayer._partPageRectanglesPixels[page]; - } - return null; + getPageSizes: function () { + return { + twips: this._docLayer._partPageRectanglesTwips, + pixels: this._docLayer._partPageRectanglesPixels}; }, getDocType: function () {