Let the two annotation factories use static methods

This corresponds to how other factories are implemented.
This commit is contained in:
Tim van der Meij 2017-08-27 00:30:00 +02:00
parent af10f8b586
commit 4f02857394
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
4 changed files with 48 additions and 53 deletions

View file

@ -38,7 +38,7 @@ class AnnotationElementFactory {
* @param {AnnotationElementParameters} parameters
* @returns {AnnotationElement}
*/
create(parameters) {
static create(parameters) {
let subtype = parameters.data.annotationType;
switch (subtype) {
@ -974,14 +974,12 @@ class AnnotationLayer {
* @memberof AnnotationLayer
*/
static render(parameters) {
let annotationElementFactory = new AnnotationElementFactory();
for (let i = 0, ii = parameters.annotations.length; i < ii; i++) {
let data = parameters.annotations[i];
if (!data) {
continue;
}
let element = annotationElementFactory.create({
let element = AnnotationElementFactory.create({
data,
layer: parameters.div,
page: parameters.page,