Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions packages/annotation/js/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ $(document).ready(function () {
// set text rows data to null
rows = null;
// append svg element to each page, this is required to draw svg based annotations
addSvgContainer();
addSvgContainer(documentData.pages);
if (isMobile() || fitWidth) {
setZoomLevel("Fit Width");
}
Expand Down Expand Up @@ -1157,9 +1157,25 @@ function download(button) {
/**
* Append SVG container to each document page
*/
function addSvgContainer() {
function addSvgContainer(pages) {
$('div.gd-page').each(function (index, page) {
$(page).css("zoom", "1");
var width = page.offsetWidth;
var height = page.offsetHeight;
//Cells document pages size fix
if (getDocumentFormat(documentGuid).format == "Microsoft Excel") {
width = 500;
height = 300;
$(page).css("width", width);
$(page).css("height", height);
$(page).css("min-width", width);
$(page).css("min-height", height);
$(page).css("overflow", "scroll");
$(page).find("img").css("width", pages[index].width);
width = pages[index].width;
height = pages[index].height;
}
// add svg object to the list for further use
// initiate svg object
if (svgList == null) {
svgList = {};
Expand All @@ -1168,9 +1184,8 @@ function addSvgContainer() {
return true;
} else {
if (!(page.id in svgList) && $(page).find("svg").length == 0) {
$(page).addClass("gd-disable-select");
// add svg object to the list for further use
var draw = SVG(page.id).size(page.offsetWidth, page.offsetHeight);
$(page).addClass("gd-disable-select");
var draw = SVG(page.id).size(width, height);
svgList[page.id] = draw;
draw = null;
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/annotation/js/drawTextAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ $(document).ready(function () {
// set mouse up event
// this handler used to get annotation width and height after draw process
$(canvas).on(userMouseUp, function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (['textField','watermark'].indexOf(currentPrefix) >= 0) {
attachTextFieldBehaviour(element,annotation);
}
Expand All @@ -186,6 +188,9 @@ $(document).ready(function () {
addComment(annotationsList[annotationsList.length - 1]);
}
}
if (!element) {
element = $(".gd-annotation")[0];
}
makeResizable(annotation, element);
annotationInnerHtml = null;
lineInnerHtml = null;
Expand All @@ -209,6 +214,7 @@ $(document).ready(function () {
if (element !== null) {
var currentWidth = (isNaN(parseInt(element.style.width))) ? 0 : parseInt(element.style.width);
var currentHeight = (isNaN(parseInt(element.style.height))) ? 0 : parseInt(element.style.height);

if (mouse.x != 0) {
element.style.width = Math.abs(startX - mouse.x) + "px";
}
Expand Down