|
|
@ -21,6 +21,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var HIGHLIGHT_OFFSET = 4; // px
|
|
|
|
|
|
|
|
var SUPPORTED_TYPES = ['Link', 'Text', 'Widget']; |
|
|
|
|
|
|
|
|
|
|
|
var Annotation = (function AnnotationClosure() { |
|
|
|
var Annotation = (function AnnotationClosure() { |
|
|
|
// 12.5.5: Algorithm: Appearance streams
|
|
|
|
// 12.5.5: Algorithm: Appearance streams
|
|
|
|
function getTransformMatrix(rect, bbox, matrix) { |
|
|
|
function getTransformMatrix(rect, bbox, matrix) { |
|
|
@ -143,25 +146,50 @@ var Annotation = (function AnnotationClosure() { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// TODO(mack): Remove this, it's not really that helpful.
|
|
|
|
// TODO(mack): Remove this, it's not really that helpful.
|
|
|
|
getEmptyContainer: function Annotation_getEmptyContainer(tagName, rect) { |
|
|
|
getEmptyContainer: function Annotation_getEmptyContainer(tagName, rect, |
|
|
|
|
|
|
|
borderWidth) { |
|
|
|
assert(!isWorker, |
|
|
|
assert(!isWorker, |
|
|
|
'getEmptyContainer() should be called from main thread'); |
|
|
|
'getEmptyContainer() should be called from main thread'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bWidth = borderWidth || 0; |
|
|
|
|
|
|
|
|
|
|
|
rect = rect || this.data.rect; |
|
|
|
rect = rect || this.data.rect; |
|
|
|
var element = document.createElement(tagName); |
|
|
|
var element = document.createElement(tagName); |
|
|
|
element.style.width = Math.ceil(rect[2] - rect[0]) + 'px'; |
|
|
|
element.style.borderWidth = bWidth + 'px'; |
|
|
|
element.style.height = Math.ceil(rect[3] - rect[1]) + 'px'; |
|
|
|
var width = rect[2] - rect[0] - 2 * bWidth; |
|
|
|
|
|
|
|
var height = rect[3] - rect[1] - 2 * bWidth; |
|
|
|
|
|
|
|
element.style.width = width + 'px'; |
|
|
|
|
|
|
|
element.style.height = height + 'px'; |
|
|
|
return element; |
|
|
|
return element; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isInvisible: function Annotation_isInvisible() { |
|
|
|
|
|
|
|
var data = this.data; |
|
|
|
|
|
|
|
if (data && SUPPORTED_TYPES.indexOf(data.subtype) !== -1) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return !!(data && |
|
|
|
|
|
|
|
data.annotationFlags && // Default: not invisible
|
|
|
|
|
|
|
|
data.annotationFlags & 0x1); // Invisible
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isViewable: function Annotation_isViewable() { |
|
|
|
isViewable: function Annotation_isViewable() { |
|
|
|
var data = this.data; |
|
|
|
var data = this.data; |
|
|
|
return !!( |
|
|
|
return !!(!this.isInvisible() && |
|
|
|
data && |
|
|
|
data && |
|
|
|
(!data.annotationFlags || |
|
|
|
(!data.annotationFlags || |
|
|
|
!(data.annotationFlags & 0x22)) && // Hidden or NoView
|
|
|
|
!(data.annotationFlags & 0x22)) && // Hidden or NoView
|
|
|
|
data.rect // rectangle is nessessary
|
|
|
|
data.rect); // rectangle is nessessary
|
|
|
|
); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isPrintable: function Annotation_isPrintable() { |
|
|
|
|
|
|
|
var data = this.data; |
|
|
|
|
|
|
|
return !!(!this.isInvisible() && |
|
|
|
|
|
|
|
data && |
|
|
|
|
|
|
|
data.annotationFlags && // Default: not printable
|
|
|
|
|
|
|
|
data.annotationFlags & 0x4 && // Print
|
|
|
|
|
|
|
|
data.rect); // rectangle is nessessary
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
loadResources: function(keys) { |
|
|
|
loadResources: function(keys) { |
|
|
@ -182,7 +210,7 @@ var Annotation = (function AnnotationClosure() { |
|
|
|
return promise; |
|
|
|
return promise; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getOperatorList: function Annotation_getToOperatorList(evaluator) { |
|
|
|
getOperatorList: function Annotation_getOperatorList(evaluator) { |
|
|
|
|
|
|
|
|
|
|
|
var promise = new LegacyPromise(); |
|
|
|
var promise = new LegacyPromise(); |
|
|
|
|
|
|
|
|
|
|
@ -289,7 +317,7 @@ var Annotation = (function AnnotationClosure() { |
|
|
|
|
|
|
|
|
|
|
|
var annotation = new Constructor(params); |
|
|
|
var annotation = new Constructor(params); |
|
|
|
|
|
|
|
|
|
|
|
if (annotation.isViewable()) { |
|
|
|
if (annotation.isViewable() || annotation.isPrintable()) { |
|
|
|
return annotation; |
|
|
|
return annotation; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
warn('unimplemented annotation type: ' + subtype); |
|
|
|
warn('unimplemented annotation type: ' + subtype); |
|
|
@ -297,7 +325,7 @@ var Annotation = (function AnnotationClosure() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Annotation.appendToOperatorList = function Annotation_appendToOperatorList( |
|
|
|
Annotation.appendToOperatorList = function Annotation_appendToOperatorList( |
|
|
|
annotations, opList, pdfManager, partialEvaluator) { |
|
|
|
annotations, opList, pdfManager, partialEvaluator, intent) { |
|
|
|
|
|
|
|
|
|
|
|
function reject(e) { |
|
|
|
function reject(e) { |
|
|
|
annotationsReadyPromise.reject(e); |
|
|
|
annotationsReadyPromise.reject(e); |
|
|
@ -307,7 +335,11 @@ var Annotation = (function AnnotationClosure() { |
|
|
|
|
|
|
|
|
|
|
|
var annotationPromises = []; |
|
|
|
var annotationPromises = []; |
|
|
|
for (var i = 0, n = annotations.length; i < n; ++i) { |
|
|
|
for (var i = 0, n = annotations.length; i < n; ++i) { |
|
|
|
annotationPromises.push(annotations[i].getOperatorList(partialEvaluator)); |
|
|
|
if (intent === 'display' && annotations[i].isViewable() || |
|
|
|
|
|
|
|
intent === 'print' && annotations[i].isPrintable()) { |
|
|
|
|
|
|
|
annotationPromises.push( |
|
|
|
|
|
|
|
annotations[i].getOperatorList(partialEvaluator)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Promise.all(annotationPromises).then(function(datas) { |
|
|
|
Promise.all(annotationPromises).then(function(datas) { |
|
|
|
opList.addOp(OPS.beginAnnotations, []); |
|
|
|
opList.addOp(OPS.beginAnnotations, []); |
|
|
@ -519,9 +551,64 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() { |
|
|
|
return TextWidgetAnnotation; |
|
|
|
return TextWidgetAnnotation; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var InteractiveAnnotation = (function InteractiveAnnotationClosure() { |
|
|
|
|
|
|
|
function InteractiveAnnotation(params) { |
|
|
|
|
|
|
|
Annotation.call(this, params); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Util.inherit(InteractiveAnnotation, Annotation, { |
|
|
|
|
|
|
|
hasHtml: function InteractiveAnnotation_hasHtml() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
highlight: function InteractiveAnnotation_highlight() { |
|
|
|
|
|
|
|
if (this.highlightElement && |
|
|
|
|
|
|
|
this.highlightElement.hasAttribute('hidden')) { |
|
|
|
|
|
|
|
this.highlightElement.removeAttribute('hidden'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unhighlight: function InteractiveAnnotation_unhighlight() { |
|
|
|
|
|
|
|
if (this.highlightElement && |
|
|
|
|
|
|
|
!this.highlightElement.hasAttribute('hidden')) { |
|
|
|
|
|
|
|
this.highlightElement.setAttribute('hidden', true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initContainer: function InteractiveAnnotation_initContainer() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var item = this.data; |
|
|
|
|
|
|
|
var rect = item.rect; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var container = this.getEmptyContainer('section', rect, item.borderWidth); |
|
|
|
|
|
|
|
container.style.backgroundColor = item.color; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var color = item.color; |
|
|
|
|
|
|
|
var rgb = []; |
|
|
|
|
|
|
|
for (var i = 0; i < 3; ++i) { |
|
|
|
|
|
|
|
rgb[i] = Math.round(color[i] * 255); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
item.colorCssRgb = Util.makeCssRgb(rgb); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var highlight = document.createElement('div'); |
|
|
|
|
|
|
|
highlight.className = 'annotationHighlight'; |
|
|
|
|
|
|
|
highlight.style.left = highlight.style.top = -HIGHLIGHT_OFFSET + 'px'; |
|
|
|
|
|
|
|
highlight.style.right = highlight.style.bottom = -HIGHLIGHT_OFFSET + 'px'; |
|
|
|
|
|
|
|
highlight.setAttribute('hidden', true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.highlightElement = highlight; |
|
|
|
|
|
|
|
container.appendChild(this.highlightElement); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return container; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return InteractiveAnnotation; |
|
|
|
|
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
function TextAnnotation(params) { |
|
|
|
function TextAnnotation(params) { |
|
|
|
Annotation.call(this, params); |
|
|
|
InteractiveAnnotation.call(this, params); |
|
|
|
|
|
|
|
|
|
|
|
if (params.data) { |
|
|
|
if (params.data) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -534,22 +621,21 @@ var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
var title = dict.get('T'); |
|
|
|
var title = dict.get('T'); |
|
|
|
data.content = stringToPDFString(content || ''); |
|
|
|
data.content = stringToPDFString(content || ''); |
|
|
|
data.title = stringToPDFString(title || ''); |
|
|
|
data.title = stringToPDFString(title || ''); |
|
|
|
data.name = !dict.has('Name') ? 'Note' : dict.get('Name').name; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ANNOT_MIN_SIZE = 10; |
|
|
|
if (data.hasAppearance) { |
|
|
|
|
|
|
|
data.name = 'NoIcon'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
data.name = dict.has('Name') ? dict.get('Name').name : 'Note'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Util.inherit(TextAnnotation, Annotation, { |
|
|
|
if (dict.has('C')) { |
|
|
|
|
|
|
|
data.hasBgColor = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getOperatorList: function TextAnnotation_getOperatorList(evaluator) { |
|
|
|
var ANNOT_MIN_SIZE = 10; |
|
|
|
var promise = new LegacyPromise(); |
|
|
|
|
|
|
|
promise.resolve(new OperatorList()); |
|
|
|
|
|
|
|
return promise; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hasHtml: function TextAnnotation_hasHtml() { |
|
|
|
Util.inherit(TextAnnotation, InteractiveAnnotation, { |
|
|
|
return true; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHtmlElement: function TextAnnotation_getHtmlElement(commonObjs) { |
|
|
|
getHtmlElement: function TextAnnotation_getHtmlElement(commonObjs) { |
|
|
|
assert(!isWorker, 'getHtmlElement() shall be called from main thread'); |
|
|
|
assert(!isWorker, 'getHtmlElement() shall be called from main thread'); |
|
|
@ -565,23 +651,40 @@ var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square
|
|
|
|
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var container = this.getEmptyContainer('section', rect); |
|
|
|
var container = this.initContainer(); |
|
|
|
container.className = 'annotText'; |
|
|
|
container.className = 'annotText'; |
|
|
|
|
|
|
|
|
|
|
|
var image = document.createElement('img'); |
|
|
|
var image = document.createElement('img'); |
|
|
|
image.style.height = container.style.height; |
|
|
|
image.style.height = container.style.height; |
|
|
|
|
|
|
|
image.style.width = container.style.width; |
|
|
|
var iconName = item.name; |
|
|
|
var iconName = item.name; |
|
|
|
image.src = PDFJS.imageResourcesPath + 'annotation-' + |
|
|
|
image.src = PDFJS.imageResourcesPath + 'annotation-' + |
|
|
|
iconName.toLowerCase() + '.svg'; |
|
|
|
iconName.toLowerCase() + '.svg'; |
|
|
|
image.alt = '[{{type}} Annotation]'; |
|
|
|
image.alt = '[{{type}} Annotation]'; |
|
|
|
image.dataset.l10nId = 'text_annotation_type'; |
|
|
|
image.dataset.l10nId = 'text_annotation_type'; |
|
|
|
image.dataset.l10nArgs = JSON.stringify({type: iconName}); |
|
|
|
image.dataset.l10nArgs = JSON.stringify({type: iconName}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var contentWrapper = document.createElement('div'); |
|
|
|
|
|
|
|
contentWrapper.className = 'annotTextContentWrapper'; |
|
|
|
|
|
|
|
contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px'; |
|
|
|
|
|
|
|
contentWrapper.style.top = '-10px'; |
|
|
|
|
|
|
|
|
|
|
|
var content = document.createElement('div'); |
|
|
|
var content = document.createElement('div'); |
|
|
|
|
|
|
|
content.className = 'annotTextContent'; |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
|
|
|
|
if (item.hasBgColor) { |
|
|
|
|
|
|
|
var color = item.color; |
|
|
|
|
|
|
|
var rgb = []; |
|
|
|
|
|
|
|
for (var i = 0; i < 3; ++i) { |
|
|
|
|
|
|
|
// Enlighten the color (70%)
|
|
|
|
|
|
|
|
var c = Math.round(color[i] * 255); |
|
|
|
|
|
|
|
rgb[i] = Math.round((255 - c) * 0.7) + c; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
content.style.backgroundColor = Util.makeCssRgb(rgb); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var title = document.createElement('h1'); |
|
|
|
var title = document.createElement('h1'); |
|
|
|
var text = document.createElement('p'); |
|
|
|
var text = document.createElement('p'); |
|
|
|
content.style.left = Math.floor(rect[2] - rect[0]) + 'px'; |
|
|
|
|
|
|
|
content.style.top = '0px'; |
|
|
|
|
|
|
|
title.textContent = item.title; |
|
|
|
title.textContent = item.title; |
|
|
|
|
|
|
|
|
|
|
|
if (!item.content && !item.title) { |
|
|
|
if (!item.content && !item.title) { |
|
|
@ -597,28 +700,57 @@ var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
text.appendChild(e); |
|
|
|
text.appendChild(e); |
|
|
|
|
|
|
|
|
|
|
|
var showAnnotation = function showAnnotation() { |
|
|
|
var pinned = false; |
|
|
|
container.style.zIndex += 1; |
|
|
|
|
|
|
|
content.removeAttribute('hidden'); |
|
|
|
var showAnnotation = function showAnnotation(pin) { |
|
|
|
|
|
|
|
if (pin) { |
|
|
|
|
|
|
|
pinned = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (content.hasAttribute('hidden')) { |
|
|
|
|
|
|
|
container.style.zIndex += 1; |
|
|
|
|
|
|
|
content.removeAttribute('hidden'); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var hideAnnotation = function hideAnnotation(e) { |
|
|
|
var hideAnnotation = function hideAnnotation(unpin) { |
|
|
|
if (e.toElement || e.relatedTarget) { // No context menu is used
|
|
|
|
if (unpin) { |
|
|
|
|
|
|
|
pinned = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!content.hasAttribute('hidden') && !pinned) { |
|
|
|
container.style.zIndex -= 1; |
|
|
|
container.style.zIndex -= 1; |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
content.setAttribute('hidden', true); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
content.addEventListener('mouseover', showAnnotation, false); |
|
|
|
var toggleAnnotation = function toggleAnnotation() { |
|
|
|
content.addEventListener('mouseout', hideAnnotation, false); |
|
|
|
if (pinned) { |
|
|
|
image.addEventListener('mouseover', showAnnotation, false); |
|
|
|
hideAnnotation(true); |
|
|
|
image.addEventListener('mouseout', hideAnnotation, false); |
|
|
|
} else { |
|
|
|
|
|
|
|
showAnnotation(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
|
|
|
|
image.addEventListener('click', function image_clickHandler() { |
|
|
|
|
|
|
|
toggleAnnotation(); |
|
|
|
|
|
|
|
}, false); |
|
|
|
|
|
|
|
image.addEventListener('mouseover', function image_mouseOverHandler() { |
|
|
|
|
|
|
|
showAnnotation(); |
|
|
|
|
|
|
|
}, false); |
|
|
|
|
|
|
|
image.addEventListener('mouseout', function image_mouseOutHandler() { |
|
|
|
|
|
|
|
hideAnnotation(); |
|
|
|
|
|
|
|
}, false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
content.addEventListener('click', function content_clickHandler() { |
|
|
|
|
|
|
|
hideAnnotation(true); |
|
|
|
|
|
|
|
}, false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
content.appendChild(title); |
|
|
|
content.appendChild(title); |
|
|
|
content.appendChild(text); |
|
|
|
content.appendChild(text); |
|
|
|
|
|
|
|
contentWrapper.appendChild(content); |
|
|
|
container.appendChild(image); |
|
|
|
container.appendChild(image); |
|
|
|
container.appendChild(content); |
|
|
|
container.appendChild(contentWrapper); |
|
|
|
|
|
|
|
|
|
|
|
return container; |
|
|
|
return container; |
|
|
|
} |
|
|
|
} |
|
|
@ -629,7 +761,7 @@ var TextAnnotation = (function TextAnnotationClosure() { |
|
|
|
|
|
|
|
|
|
|
|
var LinkAnnotation = (function LinkAnnotationClosure() { |
|
|
|
var LinkAnnotation = (function LinkAnnotationClosure() { |
|
|
|
function LinkAnnotation(params) { |
|
|
|
function LinkAnnotation(params) { |
|
|
|
Annotation.call(this, params); |
|
|
|
InteractiveAnnotation.call(this, params); |
|
|
|
|
|
|
|
|
|
|
|
if (params.data) { |
|
|
|
if (params.data) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -692,36 +824,28 @@ var LinkAnnotation = (function LinkAnnotationClosure() { |
|
|
|
return url; |
|
|
|
return url; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Util.inherit(LinkAnnotation, Annotation, { |
|
|
|
Util.inherit(LinkAnnotation, InteractiveAnnotation, { |
|
|
|
hasOperatorList: function LinkAnnotation_hasOperatorList() { |
|
|
|
hasOperatorList: function LinkAnnotation_hasOperatorList() { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
hasHtml: function LinkAnnotation_hasHtml() { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getHtmlElement: function LinkAnnotation_getHtmlElement(commonObjs) { |
|
|
|
getHtmlElement: function LinkAnnotation_getHtmlElement(commonObjs) { |
|
|
|
var rect = this.data.rect; |
|
|
|
|
|
|
|
var element = document.createElement('a'); |
|
|
|
|
|
|
|
var borderWidth = this.data.borderWidth; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
element.style.borderWidth = borderWidth + 'px'; |
|
|
|
var container = this.initContainer(); |
|
|
|
var color = this.data.color; |
|
|
|
container.className = 'annotLink'; |
|
|
|
var rgb = []; |
|
|
|
|
|
|
|
for (var i = 0; i < 3; ++i) { |
|
|
|
|
|
|
|
rgb[i] = Math.round(color[i] * 255); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
element.style.borderColor = Util.makeCssRgb(rgb); |
|
|
|
|
|
|
|
element.style.borderStyle = 'solid'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var width = rect[2] - rect[0] - 2 * borderWidth; |
|
|
|
var item = this.data; |
|
|
|
var height = rect[3] - rect[1] - 2 * borderWidth; |
|
|
|
var rect = item.rect; |
|
|
|
element.style.width = width + 'px'; |
|
|
|
|
|
|
|
element.style.height = height + 'px'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
element.href = this.data.url || ''; |
|
|
|
container.style.borderColor = item.colorCssRgb; |
|
|
|
return element; |
|
|
|
container.style.borderStyle = 'solid'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var link = document.createElement('a'); |
|
|
|
|
|
|
|
link.href = link.title = this.data.url || ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.appendChild(link); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return container; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|