Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

Commit 461ba6e

Browse files
Issue #52 | Fixed XLSX annotating
Improved image rendering for Cells documents - made image wrapper fixed size for any image size
1 parent 0bb88b2 commit 461ba6e

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

packages/annotation/js/annotation.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $(document).ready(function () {
8383
// set text rows data to null
8484
rows = null;
8585
// append svg element to each page, this is required to draw svg based annotations
86-
addSvgContainer();
86+
addSvgContainer(documentData.pages);
8787
if (isMobile() || fitWidth) {
8888
setZoomLevel("Fit Width");
8989
}
@@ -1157,9 +1157,25 @@ function download(button) {
11571157
/**
11581158
* Append SVG container to each document page
11591159
*/
1160-
function addSvgContainer() {
1160+
function addSvgContainer(pages) {
11611161
$('div.gd-page').each(function (index, page) {
11621162
$(page).css("zoom", "1");
1163+
var width = page.offsetWidth;
1164+
var height = page.offsetHeight;
1165+
//Cells document pages size fix
1166+
if (getDocumentFormat(documentGuid).format == "Microsoft Excel") {
1167+
width = 500;
1168+
height = 300;
1169+
$(page).css("width", width);
1170+
$(page).css("height", height);
1171+
$(page).css("min-width", width);
1172+
$(page).css("min-height", height);
1173+
$(page).css("overflow", "scroll");
1174+
$(page).find("img").css("width", pages[index].width);
1175+
width = pages[index].width;
1176+
height = pages[index].height;
1177+
}
1178+
// add svg object to the list for further use
11631179
// initiate svg object
11641180
if (svgList == null) {
11651181
svgList = {};
@@ -1168,9 +1184,8 @@ function addSvgContainer() {
11681184
return true;
11691185
} else {
11701186
if (!(page.id in svgList) && $(page).find("svg").length == 0) {
1171-
$(page).addClass("gd-disable-select");
1172-
// add svg object to the list for further use
1173-
var draw = SVG(page.id).size(page.offsetWidth, page.offsetHeight);
1187+
$(page).addClass("gd-disable-select");
1188+
var draw = SVG(page.id).size(width, height);
11741189
svgList[page.id] = draw;
11751190
draw = null;
11761191
} else {

0 commit comments

Comments
 (0)