|
|
@ -69,6 +69,12 @@ AnnotationElementFactory.prototype = |
|
|
|
return new TextAnnotationElement(parameters); |
|
|
|
return new TextAnnotationElement(parameters); |
|
|
|
|
|
|
|
|
|
|
|
case AnnotationType.WIDGET: |
|
|
|
case AnnotationType.WIDGET: |
|
|
|
|
|
|
|
var fieldType = parameters.data.fieldType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (fieldType) { |
|
|
|
|
|
|
|
case 'Tx': |
|
|
|
|
|
|
|
return new TextWidgetAnnotationElement(parameters); |
|
|
|
|
|
|
|
} |
|
|
|
return new WidgetAnnotationElement(parameters); |
|
|
|
return new WidgetAnnotationElement(parameters); |
|
|
|
|
|
|
|
|
|
|
|
case AnnotationType.POPUP: |
|
|
|
case AnnotationType.POPUP: |
|
|
@ -392,9 +398,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { |
|
|
|
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { |
|
|
|
function WidgetAnnotationElement(parameters) { |
|
|
|
function WidgetAnnotationElement(parameters) { |
|
|
|
var isRenderable = !parameters.data.hasAppearance && |
|
|
|
AnnotationElement.call(this, parameters, true); |
|
|
|
!!parameters.data.fieldValue; |
|
|
|
|
|
|
|
AnnotationElement.call(this, parameters, isRenderable); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Util.inherit(WidgetAnnotationElement, AnnotationElement, { |
|
|
|
Util.inherit(WidgetAnnotationElement, AnnotationElement, { |
|
|
@ -406,6 +410,33 @@ var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { |
|
|
|
* @returns {HTMLSectionElement} |
|
|
|
* @returns {HTMLSectionElement} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
render: function WidgetAnnotationElement_render() { |
|
|
|
render: function WidgetAnnotationElement_render() { |
|
|
|
|
|
|
|
// Show only the container for unsupported field types.
|
|
|
|
|
|
|
|
return this.container; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return WidgetAnnotationElement; |
|
|
|
|
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @class |
|
|
|
|
|
|
|
* @alias TextWidgetAnnotationElement |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
var TextWidgetAnnotationElement = ( |
|
|
|
|
|
|
|
function TextWidgetAnnotationElementClosure() { |
|
|
|
|
|
|
|
function TextWidgetAnnotationElement(parameters) { |
|
|
|
|
|
|
|
WidgetAnnotationElement.call(this, parameters); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Util.inherit(TextWidgetAnnotationElement, WidgetAnnotationElement, { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Render the text widget annotation's HTML element in the empty container. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @public |
|
|
|
|
|
|
|
* @memberof TextWidgetAnnotationElement |
|
|
|
|
|
|
|
* @returns {HTMLSectionElement} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
render: function TextWidgetAnnotationElement_render() { |
|
|
|
var content = document.createElement('div'); |
|
|
|
var content = document.createElement('div'); |
|
|
|
content.textContent = this.data.fieldValue; |
|
|
|
content.textContent = this.data.fieldValue; |
|
|
|
var textAlignment = this.data.textAlignment; |
|
|
|
var textAlignment = this.data.textAlignment; |
|
|
@ -427,10 +458,10 @@ var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { |
|
|
|
* @private |
|
|
|
* @private |
|
|
|
* @param {HTMLDivElement} element |
|
|
|
* @param {HTMLDivElement} element |
|
|
|
* @param {Object} font |
|
|
|
* @param {Object} font |
|
|
|
* @memberof WidgetAnnotationElement |
|
|
|
* @memberof TextWidgetAnnotationElement |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_setTextStyle: |
|
|
|
_setTextStyle: |
|
|
|
function WidgetAnnotationElement_setTextStyle(element, font) { |
|
|
|
function TextWidgetAnnotationElement_setTextStyle(element, font) { |
|
|
|
// TODO: This duplicates some of the logic in CanvasGraphics.setFont().
|
|
|
|
// TODO: This duplicates some of the logic in CanvasGraphics.setFont().
|
|
|
|
var style = element.style; |
|
|
|
var style = element.style; |
|
|
|
style.fontSize = this.data.fontSize + 'px'; |
|
|
|
style.fontSize = this.data.fontSize + 'px'; |
|
|
@ -452,7 +483,7 @@ var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return WidgetAnnotationElement; |
|
|
|
return TextWidgetAnnotationElement; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|