Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect position of text widget #6758

Merged
merged 1 commit into from Dec 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/display/annotation_layer.js
Expand Up @@ -123,13 +123,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
return container;
}

function getHtmlElementForTextWidgetAnnotation(item, page) {
var element = document.createElement('div');
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';
function getHtmlElementForTextWidgetAnnotation(item, page, viewport) {
var container = getContainer(item, page, viewport);

var content = document.createElement('div');
content.textContent = item.fieldValue;
Expand All @@ -142,9 +137,9 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
page.commonObjs.getData(item.fontRefName) : null;
setTextStyles(content, item, fontObj);

element.appendChild(content);
container.appendChild(content);

return element;
return container;
}

function getHtmlElementForTextAnnotation(item, page, viewport) {
Expand Down Expand Up @@ -313,7 +308,7 @@ var AnnotationLayer = (function AnnotationLayerClosure() {
function getHtmlElement(data, page, viewport, linkService) {
switch (data.annotationType) {
case AnnotationType.WIDGET:
return getHtmlElementForTextWidgetAnnotation(data, page);
return getHtmlElementForTextWidgetAnnotation(data, page, viewport);
case AnnotationType.TEXT:
return getHtmlElementForTextAnnotation(data, page, viewport);
case AnnotationType.LINK:
Expand Down