Merge pull request #6758 from KamiHQ/fix-text-widget
Fix incorrect position of text widget
This commit is contained in:
commit
a1aec826ea
@ -123,13 +123,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
|
|||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHtmlElementForTextWidgetAnnotation(item, page) {
|
function getHtmlElementForTextWidgetAnnotation(item, page, viewport) {
|
||||||
var element = document.createElement('div');
|
var container = getContainer(item, page, viewport);
|
||||||
var width = item.rect[2] - item.rect[0];
|
|
||||||
var height = item.rect[3] - item.rect[1];
|
|
||||||
element.style.width = width + 'px';
|
|
||||||
element.style.height = height + 'px';
|
|
||||||
element.style.display = 'table';
|
|
||||||
|
|
||||||
var content = document.createElement('div');
|
var content = document.createElement('div');
|
||||||
content.textContent = item.fieldValue;
|
content.textContent = item.fieldValue;
|
||||||
@ -142,9 +137,9 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
|
|||||||
page.commonObjs.getData(item.fontRefName) : null;
|
page.commonObjs.getData(item.fontRefName) : null;
|
||||||
setTextStyles(content, item, fontObj);
|
setTextStyles(content, item, fontObj);
|
||||||
|
|
||||||
element.appendChild(content);
|
container.appendChild(content);
|
||||||
|
|
||||||
return element;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHtmlElementForTextAnnotation(item, page, viewport) {
|
function getHtmlElementForTextAnnotation(item, page, viewport) {
|
||||||
@ -313,7 +308,7 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
|
|||||||
function getHtmlElement(data, page, viewport, linkService) {
|
function getHtmlElement(data, page, viewport, linkService) {
|
||||||
switch (data.annotationType) {
|
switch (data.annotationType) {
|
||||||
case AnnotationType.WIDGET:
|
case AnnotationType.WIDGET:
|
||||||
return getHtmlElementForTextWidgetAnnotation(data, page);
|
return getHtmlElementForTextWidgetAnnotation(data, page, viewport);
|
||||||
case AnnotationType.TEXT:
|
case AnnotationType.TEXT:
|
||||||
return getHtmlElementForTextAnnotation(data, page, viewport);
|
return getHtmlElementForTextAnnotation(data, page, viewport);
|
||||||
case AnnotationType.LINK:
|
case AnnotationType.LINK:
|
||||||
|
Loading…
Reference in New Issue
Block a user