@syncfusion/ej2-pdfviewer
Advanced tools
Comparing version 17.2.28-beta to 17.2.29-beta
134
CHANGELOG.md
@@ -7,4 +7,98 @@ # Changelog | ||
#### New Features | ||
- #243205, #245009 - Provided the support to include Custom stamps in stamp dropdown. | ||
- #243133 - Provided the support to customize tooltip of the hyperlink on mouse hover. | ||
- #245007 - Provided the Feet unit support in measurement annotation. | ||
#### Bug Fixes | ||
- #244499 - The shape and measurement annotations will now be rendered properly in the rotated documents. | ||
- #244481 - The script errors will no longer be thrown in PDF Viewer in IE browser. | ||
## 17.2.46 (2019-08-22) | ||
### PDF Viewer | ||
#### Breaking Changes | ||
- The following API is renamed. | ||
| Existing API name| New API Name | | ||
|------|-------------| | ||
| toolbarItem| toolbarItems| | ||
#### New Features | ||
- ‘#223065’, ‘#234860’, ‘#241770’, ‘#241487’, ‘#229426’, ‘#244801’ – Provided the support for importing and exporting the annotation details as a JSON object. | ||
#### Bug Fixes | ||
- ‘#243837’ – Exception will no longer be thrown while loading the PDF document as FileStream. | ||
## 17.2.41 (2019-08-14) | ||
### PDF Viewer | ||
#### Bug Fixes | ||
- #241487, #243077 - Annotation author name is now updated properly in the comment panel. | ||
- #242804 - The Bookmark's destination value is now maintained properly during navigation. | ||
- #241487 - The provided PDF document will now be loaded properly in the PDF Viewer control. | ||
- #244437 - Resolved the typo errors in the PDF Viewer toolbar content. | ||
- #244654 - The editAnnotation API is now working properly. | ||
- #243134 - The PDF documents load properly when render the PDF Viewer control under multiple tab with fitToPage view mode during initial loading. | ||
## 17.2.40 (2019-08-06) | ||
### PDF Viewer | ||
#### New Features | ||
- #242329 - Provided the support to customize scale ratio value of measurement annotation. | ||
- #241886 - Provided the support to display context menu in mouse up action. | ||
#### Bug Fixes | ||
- #242495, 243160 – Hyperlink element is now rendered properly for the rotated page document. | ||
- #238064 – Searched target text is now highlighted properly for the provided document. | ||
- #241904, 241294 – Converted PDF document is now rendered properly in IE browser. | ||
- #242282 – Text search is now working properly while using PDF Viewer control inside the Tab control. | ||
## 17.2.39 (2019-07-30) | ||
### PDF Viewer | ||
#### New Features | ||
- #240440 - More details have been provided in the ajaxRequestfailure event. | ||
- #242375 – Now, the annotation edit toolbar is enabled by default using the enableAnnotationToolbar property. | ||
- #241715 - Support has been provided to render the annotation modified date and time in the comment panel. | ||
#### Bug Fixes | ||
- #242803 - The request handling has been optimized for retrieving the comments details from the PDF document. | ||
## 17.2.36 (2019-07-24) | ||
### PDF Viewer | ||
#### New Features | ||
- Provided the API to modify the scale ratio to change the quality of the pages rendered in the PDF Viewer. | ||
## 17.2.35 (2019-07-17) | ||
### PDF Viewer | ||
#### Bug Fixes | ||
- #229426 - Provided the API to select, edit, and delete the annotations. | ||
## 17.2.34 (2019-07-11) | ||
### PDF Viewer | ||
#### Breaking Changes | ||
- The following event arguments are renamed. | ||
@@ -32,2 +126,4 @@ | ||
- #223253, #238694 - Provided the supports for sticky notes annotations. | ||
- #238812 – Provided support to restrict the hyperlink navigation. | ||
- #236995 – Provided support to restrict the pinch zooming using the ‘enablePinchZoom’ property. | ||
@@ -41,3 +137,41 @@ #### Bug Fixes | ||
- #232104 - Cleared the warnings in css files. | ||
- #238761 - Height of the PDF Viewer control is now maintained properly when using inside the tab control. | ||
## 17.2.28-beta (2019-06-27) | ||
### PDF Viewer | ||
#### Breaking Changes | ||
- The following event arguments are renamed. | ||
| Existing Event Arguments Name| New Event Arguments Name | | ||
|------|-------------| | ||
|IUnloadEventArgs|UnloadEventArgs| | ||
|ILoadEventArgs|LoadEventArgs| | ||
|ILoadFailedEventArgs|LoadFailedEventArgs| | ||
|IAjaxRequestFailureEventArgs|AjaxRequestFailureEventArgs| | ||
|IPageChangeEventArgs|PageChangeEventArgs| | ||
|IPageClickEventArgs|PageClickEventArgs| | ||
|IZoomChangeEventArgs|ZoomChangeEventArgs| | ||
|IHyperlinkClickEventArgs |HyperlinkClickEventArgs | | ||
|IAnnotationAddEventArgs|AnnotationAddEventArgs| | ||
|IAnnotationRemoveEventArgs|AnnotationRemoveEventArgs| | ||
|IAnnotationPropertiesChangeEventArgs|AnnotationPropertiesChangeEventArgs| | ||
#### New Features | ||
- #208298, #223253, #224643, #233655, #238694 - Provided the supports for shape annotations. | ||
- #219446, #224643, #230115, #233032, #F144297, #236825, #238694 - Provided the supports for stamp annotations. | ||
- #229426 - Provided the supports for calibrate annotations. | ||
- #223253, #238694 - Provided the supports for sticky notes annotations. | ||
#### Bug Fixes | ||
- #233161 – Now, loading Indicator will be shown properly while loading a large page size document. | ||
- #233035 - HyperlinkClick event is now triggered properly. | ||
- #234364 - Pan interaction mode is now working properly when the toolbar is disabled. | ||
- #231436 - PDF document is now rendered properly while using the PDF Viewer control inside Tab control. | ||
- #232104 - Cleared the warnings in css files. | ||
## 17.1.47 (2019-05-14) | ||
@@ -44,0 +178,0 @@ |
@@ -1,10 +0,1 @@ | ||
/*! | ||
* filename: index.d.ts | ||
* version : 17.2.28-beta | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
* Use of this code is subject to the terms of our license. | ||
* A copy of the current license can be obtained at any time by e-mailing | ||
* licensing@syncfusion.com. Any infringement will be prosecuted under | ||
* applicable laws. | ||
*/ | ||
import * as _pdfviewer from '@syncfusion/ej2-pdfviewer'; | ||
@@ -11,0 +2,0 @@ |
{ | ||
"_from": "@syncfusion/ej2-pdfviewer@*", | ||
"_id": "@syncfusion/ej2-pdfviewer@17.1.47", | ||
"_id": "@syncfusion/ej2-pdfviewer@17.2.34", | ||
"_inBundle": false, | ||
"_integrity": "sha512-0c8HntJTXjyRA8/vHzc2WwR06XKrP8j0csTbhVJ419CpYdWv4xXGkPJ+gzxYRwBlbuWWR15XixQelO+5DPo5Dg==", | ||
"_integrity": "sha512-c9e+BLzIQ4z/4ihqOtDAocHGEqv+dfFoUNQWhFOFm+NYryTEDFZMu1zVXNZ3/LnaSku9d1Sg53bpq40i5zqiRw==", | ||
"_location": "/@syncfusion/ej2-pdfviewer", | ||
@@ -26,4 +26,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-17.1.47.tgz", | ||
"_shasum": "b0c750636786013f8911ba3a9c322742d906f947", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-production/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-17.2.34.tgz", | ||
"_shasum": "20005aa251b4d6ada7d8d9dfd6aaf1b5f7327b41", | ||
"_spec": "@syncfusion/ej2-pdfviewer@*", | ||
@@ -39,15 +39,15 @@ "_where": "/jenkins/workspace/ation_hotfix_16.4.0.42_Vol4-CJVRBFC7Z7RSISPRJNEMNQSRMCB6XTG67IJD6R2DVNXFIKQEITTQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~17.2.28-beta", | ||
"@syncfusion/ej2-buttons": "~17.2.28-beta", | ||
"@syncfusion/ej2-calendars": "~17.2.28-beta", | ||
"@syncfusion/ej2-data": "~17.2.28-beta", | ||
"@syncfusion/ej2-drawings": "~17.2.28-beta", | ||
"@syncfusion/ej2-dropdowns": "~17.2.28-beta", | ||
"@syncfusion/ej2-inplace-editor": "~17.2.28-beta", | ||
"@syncfusion/ej2-inputs": "~17.2.28-beta", | ||
"@syncfusion/ej2-lists": "~17.2.28-beta", | ||
"@syncfusion/ej2-navigations": "~17.2.28-beta", | ||
"@syncfusion/ej2-notifications": "~17.2.28-beta", | ||
"@syncfusion/ej2-popups": "~17.2.28-beta", | ||
"@syncfusion/ej2-richtexteditor": "~17.2.28-beta" | ||
"@syncfusion/ej2-base": "17.2.29-beta", | ||
"@syncfusion/ej2-buttons": "17.2.29-beta", | ||
"@syncfusion/ej2-calendars": "17.2.29-beta", | ||
"@syncfusion/ej2-data": "17.2.29-beta", | ||
"@syncfusion/ej2-drawings": "17.2.29-beta", | ||
"@syncfusion/ej2-dropdowns": "17.2.29-beta", | ||
"@syncfusion/ej2-inplace-editor": "17.2.29-beta", | ||
"@syncfusion/ej2-inputs": "17.2.29-beta", | ||
"@syncfusion/ej2-lists": "17.2.29-beta", | ||
"@syncfusion/ej2-navigations": "17.2.29-beta", | ||
"@syncfusion/ej2-notifications": "17.2.29-beta", | ||
"@syncfusion/ej2-popups": "17.2.29-beta", | ||
"@syncfusion/ej2-richtexteditor": "17.2.29-beta" | ||
}, | ||
@@ -78,4 +78,4 @@ "deprecated": false, | ||
"typings": "index.d.ts", | ||
"version": "17.2.28-beta", | ||
"version": "17.2.29-beta", | ||
"sideEffects": false | ||
} |
@@ -12,3 +12,3 @@ import { IElement } from '@syncfusion/ej2-drawings'; | ||
/** @private */ | ||
export declare function findObjectUnderMouse(objects: (PdfAnnotationBaseModel)[]): IElement; | ||
export declare function findObjectUnderMouse(objects: (PdfAnnotationBaseModel)[], event: any, pdfBase: PdfViewerBase): IElement; | ||
/** @private */ | ||
@@ -15,0 +15,0 @@ export declare function findElementUnderMouse(obj: IElement, position: PointModel, padding?: number): DrawingElement; |
import { Container } from '@syncfusion/ej2-drawings'; | ||
import { isPointOverConnector } from './connector-util'; | ||
/** @private */ | ||
@@ -6,3 +7,3 @@ export function findActiveElement(event, pdfBase, pdfViewer) { | ||
var objects = findObjectsUnderMouse(pdfBase, pdfViewer, event); | ||
var object = findObjectUnderMouse(objects); | ||
var object = findObjectUnderMouse(objects, event, pdfBase); | ||
return object; | ||
@@ -24,5 +25,30 @@ } | ||
/** @private */ | ||
export function findObjectUnderMouse(objects) { | ||
export function findObjectUnderMouse( | ||
// tslint:disable-next-line | ||
objects, event, pdfBase) { | ||
var actualTarget = null; | ||
actualTarget = objects[objects.length - 1]; | ||
var offsetX = !isNaN(event.offsetX) ? event.offsetX : (event.position ? event.position.x : 0); | ||
var offsetY = !isNaN(event.offsetY) ? event.offsetY : (event.position ? event.position.y : 0); | ||
var offsetForSelector = 5; | ||
for (var i = 0; i < objects.length; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
if (!(objects[i].shapeAnnotationType === 'Distance' || objects[i].shapeAnnotationType === 'Line' || objects[i].shapeAnnotationType === 'LineWidthArrowHead')) { | ||
var bounds = objects[i].wrapper.bounds; | ||
// tslint:disable-next-line:max-line-length | ||
if ((((bounds.x - offsetForSelector) * pdfBase.getZoomFactor()) < offsetX) && (((bounds.x + bounds.width + offsetForSelector) * pdfBase.getZoomFactor()) > offsetX) && | ||
(((bounds.y - offsetForSelector) * pdfBase.getZoomFactor()) < offsetY) && (((bounds.y + bounds.height + offsetForSelector) * pdfBase.getZoomFactor()) > offsetY)) { | ||
actualTarget = objects[i]; | ||
break; | ||
} | ||
} | ||
else { | ||
var pt = { x: offsetX / pdfBase.getZoomFactor(), y: offsetY / pdfBase.getZoomFactor() }; | ||
var obj = findElementUnderMouse(objects[i], pt, offsetForSelector); | ||
var isOver = isPointOverConnector(objects[i], pt); | ||
if (obj && isOver) { | ||
actualTarget = objects[i]; | ||
break; | ||
} | ||
} | ||
} | ||
return actualTarget; | ||
@@ -29,0 +55,0 @@ } |
@@ -61,2 +61,6 @@ import { PdfAnnotationBaseModel } from './pdf-annotation-model'; | ||
export declare function initLeader(obj: PdfAnnotationBaseModel, point1: PointModel, point2: PointModel, isSecondLeader?: boolean): PathElement; | ||
/** @private */ | ||
export declare function isPointOverConnector(connector: PdfAnnotationBaseModel, reference: PointModel): boolean; | ||
/** @private */ | ||
export declare function findNearestPoint(reference: PointModel, start: PointModel, end: PointModel): PointModel; | ||
/** | ||
@@ -63,0 +67,0 @@ * @hidden |
// tslint:disable-next-line:max-line-length | ||
import { PathElement, Rect, Point, Size, RotateTransform, TextElement, randomId, identityMatrix, rotateMatrix, transformPointByMatrix } from '@syncfusion/ej2-drawings'; | ||
import { PathElement, Rect, Point, Size, RotateTransform, TextElement, randomId, identityMatrix, rotateMatrix, transformPointByMatrix, intersect3 } from '@syncfusion/ej2-drawings'; | ||
import { setElementStype, findPointsLength, findPerimeterLength } from './drawing-util'; | ||
@@ -302,2 +302,55 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
} | ||
/** @private */ | ||
export function isPointOverConnector(connector, reference) { | ||
var vertexPoints = connector.vertexPoints; | ||
for (var i = 0; i < vertexPoints.length - 1; i++) { | ||
var start = vertexPoints[i]; | ||
var end = vertexPoints[i + 1]; | ||
var rect = Rect.toBounds([start, end]); | ||
rect.Inflate(10); | ||
if (rect.containsPoint(reference)) { | ||
var intersectinPt = findNearestPoint(reference, start, end); | ||
var segment1 = { x1: start.x, x2: end.x, y1: start.y, y2: end.y }; | ||
var segment2 = { x1: reference.x, x2: intersectinPt.x, y1: reference.y, y2: intersectinPt.y }; | ||
var intersectDetails = intersect3(segment1, segment2); | ||
if (intersectDetails.enabled) { | ||
var distance = Point.findLength(reference, intersectDetails.intersectPt); | ||
if (Math.abs(distance) < 10) { | ||
return true; | ||
} | ||
} | ||
else { | ||
var rect_1 = Rect.toBounds([reference, reference]); | ||
rect_1.Inflate(3); | ||
if (rect_1.containsPoint(start) || rect_1.containsPoint(end)) { | ||
return true; | ||
} | ||
} | ||
if (Point.equals(reference, intersectinPt)) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
/** @private */ | ||
export function findNearestPoint(reference, start, end) { | ||
var shortestPoint; | ||
var shortest = Point.findLength(start, reference); | ||
var shortest1 = Point.findLength(end, reference); | ||
if (shortest > shortest1) { | ||
shortestPoint = end; | ||
} | ||
else { | ||
shortestPoint = start; | ||
} | ||
var angleBWStAndEnd = Point.findAngle(start, end); | ||
var angleBWStAndRef = Point.findAngle(shortestPoint, reference); | ||
var r = Point.findLength(shortestPoint, reference); | ||
var vaAngle = angleBWStAndRef + ((angleBWStAndEnd - angleBWStAndRef) * 2); | ||
return { | ||
x: (shortestPoint.x + r * Math.cos(vaAngle * Math.PI / 180)), | ||
y: (shortestPoint.y + r * Math.sin(vaAngle * Math.PI / 180)) | ||
}; | ||
} | ||
/** | ||
@@ -304,0 +357,0 @@ * @hidden |
@@ -143,3 +143,3 @@ import { ChildProperty, Property, Complex } from '@syncfusion/ej2-base';import { PointModel, DecoratorShapes } from '@syncfusion/ej2-drawings';import { Point } from '@syncfusion/ej2-drawings';import { Size } from '@syncfusion/ej2-drawings';import { Container } from '@syncfusion/ej2-drawings';import { AnnotationType } from './enum';import { ICommentsCollection, IReviewCollection } from '../pdfviewer'; | ||
* Represents the path data of the annotation | ||
* @default 'string' | ||
* @default '' | ||
*/ | ||
@@ -192,3 +192,3 @@ data?: string; | ||
* Represents the height of the leader of distance shapes | ||
* @default 0 | ||
* @default 40 | ||
*/ | ||
@@ -217,3 +217,3 @@ leaderHeight?: number; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default null | ||
*/ | ||
@@ -224,3 +224,3 @@ sourcePoint?: PointModel; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default None | ||
*/ | ||
@@ -231,3 +231,3 @@ sourceDecoraterShapes?: DecoratorShapes; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default None | ||
*/ | ||
@@ -238,3 +238,3 @@ taregetDecoraterShapes?: DecoratorShapes; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default null | ||
*/ | ||
@@ -251,3 +251,3 @@ targetPoint?: PointModel; | ||
* Represents bounds of the annotation | ||
* @default '' | ||
* @default new Point(0,0) | ||
*/ | ||
@@ -271,3 +271,3 @@ bounds?: PdfBoundsModel; | ||
* Represents the cloud intensity | ||
* @default -1 | ||
* @default null | ||
*/ | ||
@@ -278,3 +278,3 @@ wrapper?: Container; | ||
* Represents the dynamic stamp | ||
* @default -1 | ||
* @default false | ||
*/ | ||
@@ -285,3 +285,3 @@ isDynamicStamp?: boolean; | ||
* Represents the dynamic text. | ||
* @default -1 | ||
* @default '' | ||
*/ | ||
@@ -288,0 +288,0 @@ dynamicText?: string; |
@@ -126,3 +126,3 @@ import { ChildProperty } from '@syncfusion/ej2-base'; | ||
* Represents the path data of the annotation | ||
* @default 'string' | ||
* @default '' | ||
*/ | ||
@@ -167,3 +167,3 @@ data: string; | ||
* Represents the height of the leader of distance shapes | ||
* @default 0 | ||
* @default 40 | ||
*/ | ||
@@ -188,3 +188,3 @@ leaderHeight: number; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default null | ||
*/ | ||
@@ -194,3 +194,3 @@ sourcePoint: PointModel; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default None | ||
*/ | ||
@@ -200,3 +200,3 @@ sourceDecoraterShapes: DecoratorShapes; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default None | ||
*/ | ||
@@ -206,3 +206,3 @@ taregetDecoraterShapes: DecoratorShapes; | ||
* Represents vertex points in the line annotation or shape annotation. | ||
* @default [] | ||
* @default null | ||
*/ | ||
@@ -217,3 +217,3 @@ targetPoint: PointModel; | ||
* Represents bounds of the annotation | ||
* @default '' | ||
* @default new Point(0,0) | ||
*/ | ||
@@ -233,3 +233,3 @@ bounds: PdfBoundsModel; | ||
* Represents the cloud intensity | ||
* @default -1 | ||
* @default null | ||
*/ | ||
@@ -239,3 +239,3 @@ wrapper: Container; | ||
* Represents the dynamic stamp | ||
* @default -1 | ||
* @default false | ||
*/ | ||
@@ -245,3 +245,3 @@ isDynamicStamp: boolean; | ||
* Represents the dynamic text. | ||
* @default -1 | ||
* @default '' | ||
*/ | ||
@@ -248,0 +248,0 @@ dynamicText: string; |
@@ -116,3 +116,3 @@ import { PointModel } from '@syncfusion/ej2-drawings'; | ||
/** @private */ | ||
mouseUp(args: MouseEventArgs): void; | ||
mouseUp(args: any): void; | ||
private calculateMouseXDiff; | ||
@@ -119,0 +119,0 @@ private calculateMouseYDiff; |
@@ -96,5 +96,7 @@ var __extends = (this && this.__extends) || (function () { | ||
//remove helper | ||
this.commandHandler.tool = ''; | ||
if (this.helper) { | ||
this.commandHandler.remove(this.helper); | ||
if (this.commandHandler) { | ||
this.commandHandler.tool = ''; | ||
if (this.helper) { | ||
this.commandHandler.remove(this.helper); | ||
} | ||
} | ||
@@ -235,9 +237,11 @@ this.commandHandler = null; | ||
var object = findActiveElement(args, this.pdfViewerBase, this.commandHandler); | ||
var selectedObject = this.commandHandler.selectedItems; | ||
if ((selectedObject.annotations.length) && args.info && !args.info.ctrlKey) { | ||
this.commandHandler.clearSelection(this.pdfViewerBase.activeElements.activePageID); | ||
if (this.commandHandler) { | ||
var selectedObject = this.commandHandler.selectedItems; | ||
if ((selectedObject.annotations.length) && args.info && !args.info.ctrlKey) { | ||
this.commandHandler.clearSelection(this.pdfViewerBase.activeElements.activePageID); | ||
} | ||
if (object) { | ||
this.commandHandler.select([object.id]); | ||
} | ||
} | ||
if (object) { | ||
this.commandHandler.select([object.id]); | ||
} | ||
}; | ||
@@ -310,3 +314,3 @@ /** @private */ | ||
width: args.source.wrapper.actualSize.width, height: args.source.wrapper.actualSize.height | ||
} | ||
}, modifiedDate: args.source.modifiedDate | ||
}; | ||
@@ -873,3 +877,4 @@ if (isLineShapes(args.source)) { | ||
y: this.currentPosition.y, width: 5, height: 5 | ||
}, vertexPoints: [{ x: this.startPoint.x, y: this.startPoint.y }, { x: this.currentPosition.x, y: this.currentPosition.y }], | ||
// tslint:disable-next-line:max-line-length | ||
}, vertexPoints: [{ x: this.startPoint.x / this.pdfViewerBase.getZoomFactor(), y: this.startPoint.y / this.pdfViewerBase.getZoomFactor() }, { x: this.currentPosition.x / this.pdfViewerBase.getZoomFactor(), y: this.currentPosition.y / this.pdfViewerBase.getZoomFactor() }], | ||
shapeAnnotationType: 'Line', fillColor: this.commandHandler.drawingObject.fillColor, | ||
@@ -905,4 +910,4 @@ strokeColor: this.commandHandler.drawingObject.strokeColor, pageIndex: this.pdfViewerBase.activeElements.activePageID, | ||
if (this.drawingObject && this.currentPosition) { | ||
obj.vertexPoints[obj.vertexPoints.length - 1].x = this.currentPosition.x; | ||
obj.vertexPoints[obj.vertexPoints.length - 1].y = this.currentPosition.y; | ||
obj.vertexPoints[obj.vertexPoints.length - 1].x = this.currentPosition.x / this.pdfViewerBase.getZoomFactor(); | ||
obj.vertexPoints[obj.vertexPoints.length - 1].y = this.currentPosition.y / this.pdfViewerBase.getZoomFactor(); | ||
this.commandHandler.nodePropertyChange(obj, { vertexPoints: obj.vertexPoints }); | ||
@@ -1056,3 +1061,3 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
vertexPoints: [{ x: this.startPosition.x, y: this.startPosition.y }, { x: this.currentPosition.x, y: this.currentPosition.y }], | ||
vertexPoints: [{ x: this.startPosition.x / this.pdfViewerBase.getZoomFactor(), y: this.startPosition.y / this.pdfViewerBase.getZoomFactor() }, { x: this.currentPosition.x / this.pdfViewerBase.getZoomFactor(), y: this.currentPosition.y / this.pdfViewerBase.getZoomFactor() }], | ||
bounds: { | ||
@@ -1079,3 +1084,3 @@ x: this.currentPosition.x, | ||
// tslint:disable-next-line:max-line-length | ||
}, vertexPoints: [{ x: this.startPosition.x, y: this.startPosition.y }, { x: this.currentPosition.x, y: this.currentPosition.y }], | ||
}, vertexPoints: [{ x: this.startPosition.x / this.pdfViewerBase.getZoomFactor(), y: this.startPosition.y / this.pdfViewerBase.getZoomFactor() }, { x: this.currentPosition.x / this.pdfViewerBase.getZoomFactor(), y: this.currentPosition.y / this.pdfViewerBase.getZoomFactor() }], | ||
// tslint:disable-next-line:max-line-length | ||
@@ -1082,0 +1087,0 @@ shapeAnnotationType: this.drawingObject.shapeAnnotationType, sourceDecoraterShapes: this.drawingObject.sourceDecoraterShapes, |
@@ -5,1 +5,2 @@ /** | ||
export * from './pdfviewer/index'; | ||
export * from './diagram/index'; |
@@ -5,1 +5,2 @@ /** | ||
export * from './pdfviewer/index'; | ||
export * from './diagram/index'; |
@@ -83,2 +83,4 @@ import { PdfViewer, PdfViewerBase, AnnotationType, TextMarkupAnnotation, ShapeAnnotation, StampAnnotation, StickyNotesAnnotation, IPopupAnnotation, MeasureAnnotation } from '../index'; | ||
private selectedLineDashArray; | ||
private isUndoRedoAction; | ||
private isUndoAction; | ||
/** | ||
@@ -119,5 +121,2 @@ * @private | ||
private clearAnnotationMode; | ||
/** | ||
* @private | ||
*/ | ||
deleteAnnotation(): void; | ||
@@ -197,2 +196,3 @@ /** | ||
createPropertiesWindow(): void; | ||
private destroyPropertiesWindow; | ||
private refreshColorPicker; | ||
@@ -254,3 +254,3 @@ private createAppearanceTab; | ||
*/ | ||
getAnnotationComments(commentsAnnotations: any, parentAnnotation: any): any; | ||
getAnnotationComments(commentsAnnotations: any, parentAnnotation: any, author: string): any; | ||
private getRandomNumber; | ||
@@ -268,3 +268,3 @@ /** | ||
*/ | ||
renderAnnotations(pageNumber: number, shapeAnnotation: any, measureShapeAnnotation: any, textMarkupAnnotation: any, canvas?: any): void; | ||
renderAnnotations(pageNumber: number, shapeAnnotation: any, measureShapeAnnotation: any, textMarkupAnnotation: any, canvas?: any, isImportTextMarkup?: boolean): void; | ||
/** | ||
@@ -285,2 +285,14 @@ * @private | ||
*/ | ||
getBounds(bound: any, pageIndex: number): any; | ||
/** | ||
* @private | ||
*/ | ||
getVertexPoints(points: any[], pageIndex: number): any; | ||
/** | ||
* @private | ||
*/ | ||
getStoredAnnotations(pageIndex: number, shapeAnnotations: any[], idString: string): any[]; | ||
/** | ||
* @private | ||
*/ | ||
triggerAnnotationPropChange(pdfAnnotationBase: PdfAnnotationBaseModel, isColor: boolean, isStroke: boolean, isThickness: boolean, isOpacity: boolean, isLineStart?: boolean, isLineEnd?: boolean, isDashArray?: boolean): void; | ||
@@ -294,2 +306,13 @@ /** | ||
*/ | ||
selectAnnotation(annotationId: any, pageNumber: number, annotation: any): void; | ||
editAnnotation(annotation: any): void; | ||
private updateCollection; | ||
private modifyAnnotationProperties; | ||
/** | ||
* @private | ||
*/ | ||
updateAnnotationAuthor(annotationType: string, annotationSubType?: string): string; | ||
/** | ||
* @private | ||
*/ | ||
clear(): void; | ||
@@ -296,0 +319,0 @@ /** |
@@ -18,2 +18,3 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private renderWebLink; | ||
private triggerHyperlinkEvent; | ||
private renderDocumentLink; | ||
@@ -20,0 +21,0 @@ private setHyperlinkProperties; |
@@ -50,6 +50,9 @@ import { createElement } from '@syncfusion/ej2-base'; | ||
else { | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i]); | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i], aTag); | ||
return true; | ||
} | ||
}; | ||
aTag.onmouseover = function () { | ||
proxy.triggerHyperlinkEvent(aTag); | ||
}; | ||
} | ||
@@ -63,6 +66,9 @@ else if (this_1.pdfViewer.hyperlinkOpenState === 'NewTab') { | ||
else { | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i]); | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i], aTag); | ||
return true; | ||
} | ||
}; | ||
aTag.onmouseover = function () { | ||
proxy.triggerHyperlinkEvent(aTag); | ||
}; | ||
} | ||
@@ -75,3 +81,3 @@ else if (this_1.pdfViewer.hyperlinkOpenState === 'NewWindow') { | ||
else { | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i]); | ||
proxy.pdfViewer.fireHyperlinkClick(hyperlinks[i], aTag); | ||
window.open(hyperlinks[i], '_blank', 'scrollbars=yes,resizable=yes'); | ||
@@ -81,2 +87,5 @@ return false; | ||
}; | ||
aTag.onmouseover = function () { | ||
proxy.triggerHyperlinkEvent(aTag); | ||
}; | ||
} | ||
@@ -91,2 +100,11 @@ var pageDiv = document.getElementById(this_1.pdfViewer.element.id + '_pageDiv_' + pageIndex); | ||
}; | ||
LinkAnnotation.prototype.triggerHyperlinkEvent = function (aTag) { | ||
if (this.pdfViewerBase.tool instanceof LineTool || this.pdfViewerBase.tool instanceof PolygonDrawingTool) { | ||
return false; | ||
} | ||
else { | ||
this.pdfViewer.fireHyperlinkHover(aTag); | ||
return true; | ||
} | ||
}; | ||
LinkAnnotation.prototype.renderDocumentLink = function (linkAnnotation, linkPage, annotationY, pageIndex) { | ||
@@ -99,3 +117,3 @@ var proxy = this; | ||
aTag = this_2.setHyperlinkProperties(aTag, rect); | ||
aTag.setAttribute('href', ''); | ||
aTag.setAttribute('href', 'javascript:void(0)'); | ||
if (linkPage[i] !== undefined && linkPage[i] > 0) { | ||
@@ -102,0 +120,0 @@ var destPageHeight = (this_2.pdfViewerBase.pageSize[pageIndex].height); |
@@ -184,2 +184,6 @@ import { PdfViewer, PdfViewerBase, IRectangle, AnnotationType as AnnotType } from '../../index'; | ||
displayUnit: CalibrationUnit; | ||
/** | ||
* @private | ||
*/ | ||
measureShapeCount: number; | ||
private ratio; | ||
@@ -267,2 +271,6 @@ private volumeDepth; | ||
private getRgbCode; | ||
/** | ||
* @private | ||
*/ | ||
saveImportedMeasureAnnotations(annotation: any, pageNumber: number): any; | ||
} |
@@ -11,2 +11,6 @@ import { ColorPicker, NumericTextBox } from '@syncfusion/ej2-inputs'; | ||
function MeasureAnnotation(pdfviewer, pdfViewerBase) { | ||
/** | ||
* @private | ||
*/ | ||
this.measureShapeCount = 0; | ||
this.pdfViewer = pdfviewer; | ||
@@ -42,6 +46,6 @@ this.pdfViewerBase = pdfViewerBase; | ||
this.volumeThickness = this.pdfViewer.volumeSettings.thickness ? this.pdfViewer.volumeSettings.thickness : 1; | ||
this.unit = 'in'; | ||
this.displayUnit = 'in'; | ||
this.ratio = 1; | ||
this.volumeDepth = 96; | ||
this.unit = this.pdfViewer.measurementSettings.conversionUnit; | ||
this.displayUnit = this.pdfViewer.measurementSettings.displayUnit; | ||
this.ratio = this.pdfViewer.measurementSettings.scaleRatio; | ||
this.volumeDepth = this.pdfViewer.measurementSettings.depth; | ||
this.scaleRatioString = '1 ' + this.unit + ' = ' + '1 ' + this.displayUnit; | ||
@@ -66,57 +70,63 @@ } | ||
if (shapeAnnotations.length >= 1) { | ||
for (var i = 0; i < shapeAnnotations.length; i++) { | ||
// tslint:disable-next-line | ||
var annotation = shapeAnnotations[i]; | ||
var annotationObject = null; | ||
if (annotation.ShapeAnnotationType) { | ||
var vertexPoints = null; | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
// tslint:disable-next-line | ||
var measureAnnots = this.pdfViewer.annotation.getStoredAnnotations(pageNumber, shapeAnnotations, '_annotations_shape_measure'); | ||
if (!measureAnnots) { | ||
for (var i = 0; i < shapeAnnotations.length; i++) { | ||
// tslint:disable-next-line | ||
var annotation = shapeAnnotations[i]; | ||
var annotationObject = null; | ||
this.measureShapeCount = this.measureShapeCount + 1; | ||
if (annotation.ShapeAnnotationType) { | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('measure', annotation.Subject); | ||
var vertexPoints = null; | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
} | ||
} | ||
var measureObject = { | ||
// tslint:disable-next-line:max-line-length | ||
ratio: annotation.Calibrate.Ratio, x: this.getNumberFormatArray(annotation.Calibrate.X), distance: this.getNumberFormatArray(annotation.Calibrate.Distance), area: this.getNumberFormatArray(annotation.Calibrate.Area), angle: this.getNumberFormatArray(annotation.Calibrate.Angle), volume: this.getNumberFormatArray(annotation.Calibrate.Volume), | ||
targetUnitConversion: annotation.Calibrate.TargetUnitConversion | ||
}; | ||
if (annotation.Calibrate.Depth) { | ||
measureObject.depth = annotation.Calibrate.Depth; | ||
} | ||
annotationObject = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'measure' + this.measureShapeCount, shapeAnnotationType: annotation.ShapeAnnotationType, author: annotation.Author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
// tslint:disable-next-line:max-line-length | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, | ||
// tslint:disable-next-line:max-line-length | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom }, | ||
caption: annotation.Caption, captionPosition: annotation.CaptionPosition, calibrate: measureObject, leaderLength: annotation.LeaderLength, leaderLineExtension: annotation.LeaderLineExtension, | ||
// tslint:disable-next-line:max-line-length | ||
leaderLineOffset: annotation.LeaderLineOffset, indent: annotation.Indent, annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), | ||
review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author } | ||
}; | ||
var annot = void 0; | ||
// tslint:disable-next-line | ||
var vPoints = annotationObject.vertexPoints; | ||
if (vertexPoints == null) { | ||
vPoints = []; | ||
} | ||
annot = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'measure' + this.measureShapeCount, shapeAnnotationType: this.getShapeType(annotationObject), author: annotationObject.author, modifiedDate: annotationObject.modifiedDate, | ||
subject: annotationObject.subject, notes: annotationObject.note, fillColor: annotationObject.fillColor, strokeColor: annotationObject.strokeColor, opacity: annotationObject.opacity, | ||
// tslint:disable-next-line:max-line-length | ||
thickness: annotationObject.thickness, borderStyle: annotationObject.borderStyle, borderDashArray: annotationObject.borderDashArray.toString(), rotateAngle: parseFloat(annotationObject.rotateAngle.split('Angle')[1]), | ||
isCloudShape: annotationObject.isCloudShape, cloudIntensity: annotationObject.cloudIntensity, taregetDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadEnd), sourceDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadStart), | ||
// tslint:disable-next-line:max-line-length | ||
vertexPoints: vPoints, bounds: { x: annotationObject.bounds.left, y: annotationObject.bounds.top, width: annotationObject.bounds.width, height: annotationObject.bounds.height }, leaderHeight: annotationObject.leaderLength, | ||
pageIndex: pageNumber, annotName: annotationObject.annotName, comments: annotationObject.comments, review: annotationObject.review, | ||
measureType: this.getMeasureType(annotationObject) | ||
}; | ||
this.pdfViewer.annotation.storeAnnotations(pageNumber, annotationObject, '_annotations_shape_measure'); | ||
this.pdfViewer.add(annot); | ||
} | ||
var measureObject = { | ||
// tslint:disable-next-line:max-line-length | ||
ratio: annotation.Calibrate.Ratio, x: this.getNumberFormatArray(annotation.Calibrate.X), distance: this.getNumberFormatArray(annotation.Calibrate.Distance), area: this.getNumberFormatArray(annotation.Calibrate.Area), angle: this.getNumberFormatArray(annotation.Calibrate.Angle), volume: this.getNumberFormatArray(annotation.Calibrate.Volume), | ||
targetUnitConversion: annotation.Calibrate.TargetUnitConversion | ||
}; | ||
if (annotation.Calibrate.Depth) { | ||
measureObject.depth = annotation.Calibrate.Depth; | ||
} | ||
annotationObject = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'measure' + i, shapeAnnotationType: annotation.ShapeAnnotationType, author: annotation.Author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
// tslint:disable-next-line:max-line-length | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, | ||
// tslint:disable-next-line:max-line-length | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom }, | ||
caption: annotation.Caption, captionPosition: annotation.CaptionPosition, calibrate: measureObject, leaderLength: annotation.LeaderLength, leaderLineExtension: annotation.LeaderLineExtension, | ||
// tslint:disable-next-line:max-line-length | ||
leaderLineOffset: annotation.LeaderLineOffset, indent: annotation.Indent, annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation), | ||
review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author } | ||
}; | ||
var annot = void 0; | ||
// tslint:disable-next-line | ||
var vPoints = annotationObject.vertexPoints; | ||
if (vertexPoints == null) { | ||
vPoints = []; | ||
} | ||
annot = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'measure' + i, shapeAnnotationType: this.getShapeType(annotationObject), author: annotationObject.author, modifiedDate: annotationObject.modifiedDate, | ||
subject: annotationObject.subject, notes: annotationObject.note, fillColor: annotationObject.fillColor, strokeColor: annotationObject.strokeColor, opacity: annotationObject.opacity, | ||
// tslint:disable-next-line:max-line-length | ||
thickness: annotationObject.thickness, borderStyle: annotationObject.borderStyle, borderDashArray: annotationObject.borderDashArray.toString(), rotateAngle: parseFloat(annotationObject.rotateAngle.split('Angle')[1]), | ||
isCloudShape: annotationObject.isCloudShape, cloudIntensity: annotationObject.cloudIntensity, taregetDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadEnd), sourceDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadStart), | ||
// tslint:disable-next-line:max-line-length | ||
vertexPoints: vPoints, bounds: { x: annotationObject.bounds.left, y: annotationObject.bounds.top, width: annotationObject.bounds.width, height: annotationObject.bounds.height }, leaderHeight: annotationObject.leaderLength, | ||
pageIndex: pageNumber, annotName: annotationObject.annotName, comments: annotationObject.comments, review: annotationObject.review, | ||
measureType: this.getMeasureType(annotationObject) | ||
}; | ||
this.pdfViewer.annotation.storeAnnotations(pageNumber, annotationObject, '_annotations_shape_measure'); | ||
this.pdfViewer.add(annot); | ||
} | ||
@@ -205,5 +215,8 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('measure', (annotationModel.pageIndex + 1)); | ||
document.getElementById(commentsDivid).id = annotationName; | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('shape_measure', (annotationModel.pageIndex + 1), annotationModel.measureType); | ||
if (commentsDivid) { | ||
document.getElementById(commentsDivid).id = annotationName; | ||
} | ||
annotationModel.annotName = annotationName; | ||
annotationModel.author = this.pdfViewer.annotationModule.updateAnnotationAuthor('measure', annotationModel.subject); | ||
this.pdfViewer.annotation.stickyNotesAnnotationModule.addTextToComments(annotationName, annotationModel.notes); | ||
@@ -329,5 +342,7 @@ if (annotationModel.wrapper.bounds) { | ||
var numberFormatArray = new Array(); | ||
for (var i = 0; i < list.length; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
numberFormatArray[i] = { unit: list[i].Unit, fractionalType: list[i].FractionalType, conversionFactor: list[i].ConversionFactor, denominator: list[i].Denominator, formatDenominator: list[i].FormatDenominator }; | ||
if (list) { | ||
for (var i = 0; i < list.length; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
numberFormatArray[i] = { unit: list[i].Unit, fractionalType: list[i].FractionalType, conversionFactor: list[i].ConversionFactor, denominator: list[i].Denominator, formatDenominator: list[i].FormatDenominator }; | ||
} | ||
} | ||
@@ -369,3 +384,3 @@ return numberFormatArray; | ||
// tslint:disable-next-line:max-line-length | ||
pageAnnotationObject.annotations[z].bounds = JSON.stringify(pageAnnotationObject.annotations[z].bounds); | ||
pageAnnotationObject.annotations[z].bounds = JSON.stringify(this.pdfViewer.annotation.getBounds(pageAnnotationObject.annotations[z].bounds, pageAnnotationObject.pageIndex)); | ||
var strokeColorString = pageAnnotationObject.annotations[z].strokeColor; | ||
@@ -375,3 +390,4 @@ pageAnnotationObject.annotations[z].strokeColor = JSON.stringify(this.getRgbCode(strokeColorString)); | ||
pageAnnotationObject.annotations[z].fillColor = JSON.stringify(this.getRgbCode(fillColorString)); | ||
pageAnnotationObject.annotations[z].vertexPoints = JSON.stringify(pageAnnotationObject.annotations[z].vertexPoints); | ||
// tslint:disable-next-line:max-line-length | ||
pageAnnotationObject.annotations[z].vertexPoints = JSON.stringify(this.pdfViewer.annotation.getVertexPoints(pageAnnotationObject.annotations[z].vertexPoints, pageAnnotationObject.pageIndex)); | ||
if (pageAnnotationObject.annotations[z].rectangleDifference !== null) { | ||
@@ -438,3 +454,3 @@ // tslint:disable-next-line:max-line-length | ||
// tslint:disable-next-line:max-line-length | ||
var items = [{ text: 'pt' }, { text: 'in' }, { text: 'mm' }, { text: 'cm' }, { text: 'p' }]; | ||
var items = [{ text: 'pt' }, { text: 'in' }, { text: 'mm' }, { text: 'cm' }, { text: 'p' }, { text: 'ft' }]; | ||
var labelText = createElement('div', { id: elementID + '_scale_ratio_label', className: 'e-pv-scale-ratio-text' }); | ||
@@ -546,2 +562,3 @@ labelText.textContent = this.pdfViewer.localeObj.getConstant('Scale Ratio'); | ||
if (property === 'bounds') { | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAnnotationModifiedDate(annotationBase, true); | ||
if (pageAnnotations[i].shapeAnnotationType === 'Line' || pageAnnotations[i].shapeAnnotationType === 'Polyline') { | ||
@@ -774,2 +791,5 @@ pageAnnotations[i].vertexPoints = annotationBase.vertexPoints; | ||
break; | ||
case 'ft': | ||
factor = 1 / 864; | ||
break; | ||
} | ||
@@ -800,2 +820,5 @@ return factor; | ||
break; | ||
case 'ft': | ||
factor = 864; | ||
break; | ||
} | ||
@@ -832,4 +855,43 @@ return factor; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
// tslint:disable-next-line | ||
MeasureAnnotation.prototype.saveImportedMeasureAnnotations = function (annotation, pageNumber) { | ||
var annotationObject = null; | ||
var vertexPoints = null; | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
} | ||
} | ||
var measureObject = { | ||
// tslint:disable-next-line:max-line-length | ||
ratio: annotation.Calibrate.Ratio, x: this.getNumberFormatArray(annotation.Calibrate.X), distance: this.getNumberFormatArray(annotation.Calibrate.Distance), area: this.getNumberFormatArray(annotation.Calibrate.Area), angle: this.getNumberFormatArray(annotation.Calibrate.Angle), volume: this.getNumberFormatArray(annotation.Calibrate.Volume), | ||
targetUnitConversion: annotation.Calibrate.TargetUnitConversion | ||
}; | ||
if (annotation.Calibrate.Depth) { | ||
measureObject.depth = annotation.Calibrate.Depth; | ||
} | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('measure', annotation.Subject); | ||
annotationObject = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'measure', shapeAnnotationType: annotation.ShapeAnnotationType, author: annotation.Author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
// tslint:disable-next-line:max-line-length | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, | ||
// tslint:disable-next-line:max-line-length | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom }, | ||
caption: annotation.Caption, captionPosition: annotation.CaptionPosition, calibrate: measureObject, leaderLength: annotation.LeaderLength, leaderLineExtension: annotation.LeaderLineExtension, | ||
// tslint:disable-next-line:max-line-length | ||
leaderLineOffset: annotation.LeaderLineOffset, indent: annotation.Indent, annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), | ||
review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author } | ||
}; | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_shape_measure'); | ||
}; | ||
return MeasureAnnotation; | ||
}()); | ||
export { MeasureAnnotation }; |
@@ -147,3 +147,6 @@ import { PdfViewer, PdfViewerBase, IRectangle, ICommentsCollection, IReviewCollection, AnnotationType as AnnotType, LineHeadStyle } from '../../index'; | ||
arrowEndHead: LineHeadStyle; | ||
private author; | ||
/** | ||
* @private | ||
*/ | ||
shapeCount: number; | ||
constructor(pdfviewer: PdfViewer, pdfViewerBase: PdfViewerBase); | ||
@@ -177,2 +180,6 @@ /** | ||
private getRgbCode; | ||
/** | ||
* @private | ||
*/ | ||
saveImportedShapeAnnotations(annotation: any, pageNumber: number): any; | ||
} |
@@ -8,2 +8,6 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
function ShapeAnnotation(pdfviewer, pdfViewerBase) { | ||
/** | ||
* @private | ||
*/ | ||
this.shapeCount = 0; | ||
this.pdfViewer = pdfviewer; | ||
@@ -37,3 +41,2 @@ this.pdfViewerBase = pdfViewerBase; | ||
this.polygonOpacity = this.pdfViewer.polygonSettings.opacity ? this.pdfViewer.polygonSettings.opacity : 1; | ||
this.author = this.pdfViewer.lineSettings.author; | ||
} | ||
@@ -47,47 +50,59 @@ /** | ||
if (shapeAnnotations.length >= 1) { | ||
for (var i = 0; i < shapeAnnotations.length; i++) { | ||
// tslint:disable-next-line | ||
var annotation = shapeAnnotations[i]; | ||
var annotationObject = null; | ||
if (annotation.ShapeAnnotationType) { | ||
var vertexPoints = null; | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
// tslint:disable-next-line | ||
var shapeAnnots = this.pdfViewer.annotation.getStoredAnnotations(pageNumber, shapeAnnotations, '_annotations_shape'); | ||
if (!shapeAnnots) { | ||
for (var i = 0; i < shapeAnnotations.length; i++) { | ||
// tslint:disable-next-line | ||
var annotation = shapeAnnotations[i]; | ||
var annotationObject = null; | ||
this.shapeCount = this.shapeCount + 1; | ||
if (annotation.ShapeAnnotationType) { | ||
if (annotation.Subject === 'Line' && annotation.ShapeAnnotationType === 'Polygon') { | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('shape', 'Polygon'); | ||
} | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
annotationObject = { | ||
id: 'shape' + i, shapeAnnotationType: annotation.ShapeAnnotationType, author: this.author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
else { | ||
// tslint:disable-next-line:max-line-length | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('shape', annotation.ShapeAnnotationType); | ||
} | ||
var vertexPoints = null; | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
} | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
// tslint:disable-next-line:max-line-length | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: this.author }, annotName: annotation.AnnotName, | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom } | ||
}; | ||
var annot = void 0; | ||
// tslint:disable-next-line | ||
var vPoints = annotationObject.vertexPoints; | ||
if (vertexPoints == null) { | ||
vPoints = []; | ||
annotationObject = { | ||
id: 'shape' + this.shapeCount, shapeAnnotationType: annotation.ShapeAnnotationType, author: annotation.Author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
// tslint:disable-next-line:max-line-length | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
// tslint:disable-next-line:max-line-length | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author }, annotName: annotation.AnnotName, | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom } | ||
}; | ||
var annot = void 0; | ||
// tslint:disable-next-line | ||
var vPoints = annotationObject.vertexPoints; | ||
if (vertexPoints == null) { | ||
vPoints = []; | ||
} | ||
annot = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'shape' + this.shapeCount, shapeAnnotationType: this.getShapeType(annotationObject), author: annotationObject.author, modifiedDate: annotationObject.modifiedDate, annotName: annotationObject.annotName, | ||
subject: annotationObject.subject, notes: annotationObject.note, fillColor: annotationObject.fillColor, strokeColor: annotationObject.strokeColor, opacity: annotationObject.opacity, | ||
// tslint:disable-next-line:max-line-length | ||
thickness: annotationObject.thickness, borderStyle: annotationObject.borderStyle, borderDashArray: annotationObject.borderDashArray.toString(), rotateAngle: parseFloat(annotationObject.rotateAngle.split('Angle')[1]), comments: annotationObject.comments, review: annotationObject.review, | ||
isCloudShape: annotationObject.isCloudShape, cloudIntensity: annotationObject.cloudIntensity, taregetDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadEnd), | ||
// tslint:disable-next-line:max-line-length | ||
sourceDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadStart), vertexPoints: vPoints, bounds: { x: annotationObject.bounds.left, y: annotationObject.bounds.top, width: annotationObject.bounds.width, height: annotationObject.bounds.height }, | ||
pageIndex: pageNumber | ||
}; | ||
var addedAnnot = this.pdfViewer.add(annot); | ||
if (addedAnnot.shapeAnnotationType === 'Polygon') { | ||
this.pdfViewer.nodePropertyChange(addedAnnot, { fillColor: annot.fillColor }); | ||
} | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_shape'); | ||
} | ||
annot = { | ||
// tslint:disable-next-line:max-line-length | ||
id: 'shape' + i, shapeAnnotationType: this.getShapeType(annotationObject), author: this.author, modifiedDate: annotationObject.modifiedDate, annotName: annotationObject.annotName, | ||
subject: annotationObject.subject, notes: annotationObject.note, fillColor: annotationObject.fillColor, strokeColor: annotationObject.strokeColor, opacity: annotationObject.opacity, | ||
// tslint:disable-next-line:max-line-length | ||
thickness: annotationObject.thickness, borderStyle: annotationObject.borderStyle, borderDashArray: annotationObject.borderDashArray.toString(), rotateAngle: parseFloat(annotationObject.rotateAngle.split('Angle')[1]), comments: annotationObject.comments, review: annotationObject.review, | ||
isCloudShape: annotationObject.isCloudShape, cloudIntensity: annotationObject.cloudIntensity, taregetDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadEnd), | ||
// tslint:disable-next-line:max-line-length | ||
sourceDecoraterShapes: this.pdfViewer.annotation.getArrowType(annotationObject.lineHeadStart), vertexPoints: vPoints, bounds: { x: annotationObject.bounds.left, y: annotationObject.bounds.top, width: annotationObject.bounds.width, height: annotationObject.bounds.height }, | ||
pageIndex: pageNumber | ||
}; | ||
var addedAnnot = this.pdfViewer.add(annot); | ||
if (addedAnnot.shapeAnnotationType === 'Polygon') { | ||
this.pdfViewer.nodePropertyChange(addedAnnot, { fillColor: annot.fillColor }); | ||
} | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_shape'); | ||
} | ||
@@ -249,2 +264,7 @@ } | ||
var currentAnnotObject = null; | ||
if (annotationBase) { | ||
if (property === 'bounds') { | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAnnotationModifiedDate(annotationBase, true); | ||
} | ||
} | ||
var pageAnnotations = this.getAnnotations(pageNumber, null); | ||
@@ -353,3 +373,3 @@ if (pageAnnotations != null && annotationBase) { | ||
// tslint:disable-next-line:max-line-length | ||
pageAnnotationObject.annotations[z].bounds = JSON.stringify(pageAnnotationObject.annotations[z].bounds); | ||
pageAnnotationObject.annotations[z].bounds = JSON.stringify(this.pdfViewer.annotation.getBounds(pageAnnotationObject.annotations[z].bounds, pageAnnotationObject.pageIndex)); | ||
var strokeColorString = pageAnnotationObject.annotations[z].strokeColor; | ||
@@ -360,3 +380,3 @@ pageAnnotationObject.annotations[z].strokeColor = JSON.stringify(this.getRgbCode(strokeColorString)); | ||
// tslint:disable-next-line:max-line-length | ||
pageAnnotationObject.annotations[z].vertexPoints = JSON.stringify(pageAnnotationObject.annotations[z].vertexPoints); | ||
pageAnnotationObject.annotations[z].vertexPoints = JSON.stringify(this.pdfViewer.annotation.getVertexPoints(pageAnnotationObject.annotations[z].vertexPoints, pageAnnotationObject.pageIndex)); | ||
if (pageAnnotationObject.annotations[z].rectangleDifference !== null) { | ||
@@ -392,4 +412,6 @@ // tslint:disable-next-line:max-line-length | ||
// tslint:disable-next-line:max-line-length | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('shape', (annotationModel.pageIndex + 1)); | ||
document.getElementById(commentsDivid).id = annotationName; | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('shape', (annotationModel.pageIndex + 1), annotationModel.shapeAnnotationType); | ||
if (commentsDivid) { | ||
document.getElementById(commentsDivid).id = annotationName; | ||
} | ||
annotationModel.annotName = annotationName; | ||
@@ -406,2 +428,8 @@ if (annotationModel.wrapper.bounds) { | ||
} | ||
if (annotationModel.subject === 'Line' && annotationModel.shapeAnnotationType === 'Polygon') { | ||
annotationModel.author = this.pdfViewer.annotationModule.updateAnnotationAuthor('shape', 'Polygon'); | ||
} | ||
else { | ||
annotationModel.author = this.pdfViewer.annotationModule.updateAnnotationAuthor('shape', annotationModel.subject); | ||
} | ||
// tslint:disable-next-line:radix | ||
@@ -413,4 +441,4 @@ var borderDashArray = parseInt(annotationModel.borderDashArray); | ||
// tslint:disable-next-line:max-line-length | ||
id: annotationModel.id, shapeAnnotationType: this.getShapeAnnotType(annotationModel.shapeAnnotationType), author: this.author, subject: annotationModel.subject, note: annotationModel.notes, | ||
strokeColor: annotationModel.strokeColor, annotName: annotationName, comments: [], review: { state: '', stateModel: '', modifiedDate: date.toLocaleString(), author: this.author }, | ||
id: annotationModel.id, shapeAnnotationType: this.getShapeAnnotType(annotationModel.shapeAnnotationType), author: annotationModel.author, subject: annotationModel.subject, note: annotationModel.notes, | ||
strokeColor: annotationModel.strokeColor, annotName: annotationName, comments: [], review: { state: '', stateModel: '', modifiedDate: date.toLocaleString(), author: annotationModel.author }, | ||
fillColor: annotationModel.fillColor, opacity: annotationModel.opacity, thickness: annotationModel.thickness, | ||
@@ -464,4 +492,31 @@ // tslint:disable-next-line:max-line-length | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
// tslint:disable-next-line | ||
ShapeAnnotation.prototype.saveImportedShapeAnnotations = function (annotation, pageNumber) { | ||
var annotationObject = null; | ||
var vertexPoints = null; | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('shape', annotation.Subject); | ||
if (annotation.VertexPoints) { | ||
vertexPoints = []; | ||
for (var j = 0; j < annotation.VertexPoints.length; j++) { | ||
var point = { x: annotation.VertexPoints[j].X, y: annotation.VertexPoints[j].Y }; | ||
vertexPoints.push(point); | ||
} | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
annotationObject = { | ||
id: 'shape', shapeAnnotationType: annotation.ShapeAnnotationType, author: annotation.Author, modifiedDate: annotation.ModifiedDate, subject: annotation.Subject, | ||
// tslint:disable-next-line:max-line-length | ||
note: annotation.Note, strokeColor: annotation.StrokeColor, fillColor: annotation.FillColor, opacity: annotation.Opacity, thickness: annotation.Thickness, rectangleDifference: annotation.RectangleDifference, | ||
borderStyle: annotation.BorderStyle, borderDashArray: annotation.BorderDashArray, rotateAngle: annotation.RotateAngle, isCloudShape: annotation.IsCloudShape, | ||
// tslint:disable-next-line:max-line-length | ||
cloudIntensity: annotation.CloudIntensity, vertexPoints: vertexPoints, lineHeadStart: annotation.LineHeadStart, lineHeadEnd: annotation.LineHeadEnd, isLocked: annotation.IsLocked, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author }, annotName: annotation.AnnotName, | ||
bounds: { left: annotation.Bounds.X, top: annotation.Bounds.Y, width: annotation.Bounds.Width, height: annotation.Bounds.Height, right: annotation.Bounds.Right, bottom: annotation.Bounds.Bottom } | ||
}; | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_shape'); | ||
}; | ||
return ShapeAnnotation; | ||
}()); | ||
export { ShapeAnnotation }; |
@@ -56,2 +56,6 @@ import { PdfAnnotationBase } from '../../diagram/pdf-annotation'; | ||
*/ | ||
isStampAddMode: boolean; | ||
/** | ||
* @private | ||
*/ | ||
isNewStampAnnot: boolean; | ||
@@ -68,3 +72,3 @@ private isExistingStamp; | ||
*/ | ||
renderStampAnnotations(stampAnnotations: any, pageNumber: number, canvass?: any): void; | ||
renderStampAnnotations(stampAnnotations: any, pageNumber: number, canvass?: any, isImport?: boolean): void; | ||
/** | ||
@@ -95,3 +99,3 @@ * @private | ||
*/ | ||
renderCustomImage(position: any, pageIndex: any, image: any, currentDate: any, modifiedDate: any, RotationAngle: any, opacity: any, canvas?: any): void; | ||
renderCustomImage(position: any, pageIndex: any, image: any, currentDate: any, modifiedDate: any, RotationAngle: any, opacity: any, canvas?: any, isExistingStamp?: boolean): void; | ||
private retrieveRotationAngle; | ||
@@ -118,3 +122,7 @@ /** | ||
updateSessionStorage(annotation: any, id: any, type: String): any; | ||
/** | ||
* @private | ||
*/ | ||
saveImportedStampAnnotations(annotation: any, pageNumber: number): any; | ||
} | ||
export {}; |
@@ -67,2 +67,4 @@ import { PdfViewerBase, PdfViewer } from '../index'; | ||
private commentsRequestHandler; | ||
private selectAnnotationObj; | ||
private isCommentsSelected; | ||
/** | ||
@@ -72,3 +74,2 @@ * @private | ||
isEditableElement: boolean; | ||
private author; | ||
/** | ||
@@ -82,2 +83,4 @@ * @private | ||
mainContainer: HTMLElement; | ||
private isPageCommentsRendered; | ||
private isCommentsRendered; | ||
/** | ||
@@ -90,7 +93,8 @@ * @private | ||
*/ | ||
renderStickyNotesAnnotations(stickyAnnotations: any, pageNumber: number): void; | ||
renderStickyNotesAnnotations(stickyAnnotations: any, pageNumber: number, canvas?: any): void; | ||
/** | ||
* @private | ||
*/ | ||
drawStickyNotes(X: number, Y: number, width: number, height: number, pageIndex: number, annotation: any): any; | ||
drawStickyNotes(X: number, Y: number, width: number, height: number, pageIndex: number, annotation: any, canvas?: any): any; | ||
private setImageSource; | ||
/** | ||
@@ -100,6 +104,9 @@ * @private | ||
createRequestForComments(): void; | ||
private renderAnnotationComments; | ||
/** | ||
* @private | ||
*/ | ||
renderAnnotationComments(data: any, pageIndex: number): void; | ||
/** | ||
* @private | ||
*/ | ||
initializeAcccordionContainer(): void; | ||
@@ -118,3 +125,3 @@ /** | ||
*/ | ||
createCommentControlPanel(data: any, pageIndex: number, type?: string): string; | ||
createCommentControlPanel(data: any, pageIndex: number, type?: string, annotationSubType?: string): string; | ||
private commentDivFocus; | ||
@@ -129,6 +136,7 @@ private updateScrollPosition; | ||
*/ | ||
createCommentsContainer(data: any, pageIndex: number): string; | ||
createCommentsContainer(data: any, pageIndex: number, isCopy?: boolean): string; | ||
private modifyProperty; | ||
private createTitleContainer; | ||
private createReplyDivTitleContainer; | ||
private updateCommentIcon; | ||
private updateStatusContainer; | ||
@@ -159,4 +167,9 @@ /** | ||
*/ | ||
addComments(annotationType: string, pageNumber: number): string; | ||
addComments(annotationType: string, pageNumber: number, annotationSubType?: string): string; | ||
private commentsAnnotationSelect; | ||
private updateCommentsContainerWidth; | ||
/** | ||
* @private | ||
*/ | ||
selectCommentsAnnotation(pageIndex: number): void; | ||
private setAnnotationType; | ||
@@ -183,3 +196,3 @@ private modifyTextProperty; | ||
*/ | ||
addAnnotationComments(annotation: any, type: string): void; | ||
addAnnotationComments(pageIndex: any, type: string): void; | ||
/** | ||
@@ -202,2 +215,18 @@ * @private | ||
*/ | ||
updateAnnotationCollection(newAnnotation: any, annotation: any): void; | ||
private findAnnotationType; | ||
private setExistingAnnotationModifiedDate; | ||
private setModifiedDate; | ||
private updateModifiedDate; | ||
/** | ||
* @private | ||
*/ | ||
updateAnnotationModifiedDate(annotation: any, isBounds?: boolean, isUndoRedoAction?: boolean): void; | ||
/** | ||
* @private | ||
*/ | ||
saveImportedStickyNotesAnnotations(annotation: any, pageNumber: number): any; | ||
/** | ||
* @private | ||
*/ | ||
clear(): void; | ||
@@ -204,0 +233,0 @@ /** |
@@ -78,3 +78,3 @@ import { PdfViewer, PdfViewerBase, IRectangle, ICommentsCollection, IReviewCollection } from '../index'; | ||
private currentAnnotationIndex; | ||
private author; | ||
private isAnnotationSelect; | ||
/** | ||
@@ -91,3 +91,3 @@ * @private | ||
*/ | ||
renderTextMarkupAnnotationsInPage(textMarkupAnnotations: any, pageNumber: number): void; | ||
renderTextMarkupAnnotationsInPage(textMarkupAnnotations: any, pageNumber: number, isImportTextMarkup?: boolean): void; | ||
private renderTextMarkupAnnotations; | ||
@@ -108,3 +108,3 @@ /** | ||
*/ | ||
printTextMarkupAnnotations(textMarkupAnnotations: any, pageIndex: number, stampData: any, shapeData: any): string; | ||
printTextMarkupAnnotations(textMarkupAnnotations: any, pageIndex: number, stampData: any, shapeData: any, measureShapeData: any, stickyData: any): string; | ||
/** | ||
@@ -125,3 +125,3 @@ * @private | ||
*/ | ||
modifyOpacityProperty(args: ChangeEventArgs): void; | ||
modifyOpacityProperty(args: ChangeEventArgs, isOpacity?: number): void; | ||
private modifyAnnotationProperty; | ||
@@ -135,3 +135,3 @@ /** | ||
*/ | ||
undoRedoPropertyChange(annotation: ITextMarkupAnnotation, pageNumber: number, index: number, property: string): ITextMarkupAnnotation; | ||
undoRedoPropertyChange(annotation: ITextMarkupAnnotation, pageNumber: number, index: number, property: string, isUndoAction?: boolean): ITextMarkupAnnotation; | ||
/** | ||
@@ -146,3 +146,6 @@ * @private | ||
private clearCurrentAnnotation; | ||
private clearCurrentAnnotationSelection; | ||
/** | ||
* @private | ||
*/ | ||
clearCurrentAnnotationSelection(pageNumber: number, isSelect?: boolean): void; | ||
private getBoundsForSave; | ||
@@ -205,3 +208,7 @@ private getRgbCode; | ||
*/ | ||
saveImportedTextMarkupAnnotations(annotation: any, pageNumber: number): any; | ||
/** | ||
* @private | ||
*/ | ||
clear(): void; | ||
} |
@@ -25,2 +25,3 @@ import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
this.currentAnnotationIndex = null; | ||
this.isAnnotationSelect = false; | ||
this.pdfViewer = pdfViewer; | ||
@@ -34,3 +35,2 @@ this.pdfViewerBase = viewerBase; | ||
this.strikethroughOpacity = pdfViewer.strikethroughSettings.opacity; | ||
this.author = pdfViewer.highlightSettings.author; | ||
} | ||
@@ -54,8 +54,13 @@ /** | ||
// tslint:disable-next-line | ||
TextMarkupAnnotation.prototype.renderTextMarkupAnnotationsInPage = function (textMarkupAnnotations, pageNumber) { | ||
TextMarkupAnnotation.prototype.renderTextMarkupAnnotationsInPage = function (textMarkupAnnotations, pageNumber, isImportTextMarkup) { | ||
var canvas = this.pdfViewerBase.getElement('_annotationCanvas_' + pageNumber); | ||
this.renderTextMarkupAnnotations(textMarkupAnnotations, pageNumber, canvas, this.pdfViewerBase.getZoomFactor()); | ||
if (isImportTextMarkup) { | ||
this.renderTextMarkupAnnotations(textMarkupAnnotations, pageNumber, canvas, this.pdfViewerBase.getZoomFactor(), true); | ||
} | ||
else { | ||
this.renderTextMarkupAnnotations(textMarkupAnnotations, pageNumber, canvas, this.pdfViewerBase.getZoomFactor()); | ||
} | ||
}; | ||
// tslint:disable-next-line | ||
TextMarkupAnnotation.prototype.renderTextMarkupAnnotations = function (textMarkupAnnotations, pageNumber, canvas, factor) { | ||
TextMarkupAnnotation.prototype.renderTextMarkupAnnotations = function (textMarkupAnnotations, pageNumber, canvas, factor, isImportAction) { | ||
if (canvas) { | ||
@@ -66,3 +71,9 @@ var context = canvas.getContext('2d'); | ||
// tslint:disable-next-line | ||
var annotations = this.getAnnotations(pageNumber, textMarkupAnnotations); | ||
var annotations = void 0; | ||
if (!isImportAction) { | ||
annotations = this.getAnnotations(pageNumber, textMarkupAnnotations); | ||
} | ||
else { | ||
annotations = textMarkupAnnotations; | ||
} | ||
if (annotations) { | ||
@@ -72,7 +83,8 @@ for (var i = 0; i < annotations.length; i++) { | ||
var annotation = annotations[i]; | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('textMarkup', annotation.Subject); | ||
var annotationObject = null; | ||
if (annotation.TextMarkupAnnotationType) { | ||
// tslint:disable-next-line:max-line-length | ||
annotationObject = { textMarkupAnnotationType: annotation.TextMarkupAnnotationType, color: annotation.Color, opacity: annotation.Opacity, bounds: annotation.Bounds, author: this.author, subject: annotation.Subject, modifiedDate: annotation.ModifiedDate, note: annotation.Note, rect: annotation.Rect, | ||
annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: this.author }, shapeAnnotationType: 'textMarkup' }; | ||
annotationObject = { textMarkupAnnotationType: annotation.TextMarkupAnnotationType, color: annotation.Color, opacity: annotation.Opacity, bounds: annotation.Bounds, author: annotation.Author, subject: annotation.Subject, modifiedDate: annotation.ModifiedDate, note: annotation.Note, rect: annotation.Rect, | ||
annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author }, shapeAnnotationType: 'textMarkup' }; | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_textMarkup'); | ||
@@ -100,3 +112,8 @@ } | ||
if (pageNumber === this.selectTextMarkupCurrentPage) { | ||
this.maintainAnnotationSelection(); | ||
if (!this.isAnnotationSelect) { | ||
this.maintainAnnotationSelection(); | ||
} | ||
else { | ||
this.isAnnotationSelect = false; | ||
} | ||
} | ||
@@ -142,3 +159,5 @@ } | ||
annotation = this.getAddedAnnotation(type, this.highlightColor, this.highlightOpacity, bounds, this.pdfViewer.highlightSettings.author, this.pdfViewer.highlightSettings.subject, this.pdfViewer.highlightSettings.modifiedDate, '', rect, pageNumber); | ||
this.renderHighlightAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
if (annotation) { | ||
this.renderHighlightAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
} | ||
break; | ||
@@ -148,3 +167,5 @@ case 'Strikethrough': | ||
annotation = this.getAddedAnnotation(type, this.strikethroughColor, this.strikethroughOpacity, bounds, this.pdfViewer.strikethroughSettings.author, this.pdfViewer.strikethroughSettings.subject, this.pdfViewer.strikethroughSettings.modifiedDate, '', rect, pageNumber); | ||
this.renderStrikeoutAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
if (annotation) { | ||
this.renderStrikeoutAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
} | ||
break; | ||
@@ -154,3 +175,5 @@ case 'Underline': | ||
annotation = this.getAddedAnnotation(type, this.underlineColor, this.underlineOpacity, bounds, this.pdfViewer.underlineSettings.author, this.pdfViewer.underlineSettings.subject, this.pdfViewer.underlineSettings.modifiedDate, '', rect, pageNumber); | ||
this.renderUnderlineAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
if (annotation) { | ||
this.renderUnderlineAnnotation(annotation.bounds, annotation.opacity, annotation.color, context, factor); | ||
} | ||
break; | ||
@@ -160,3 +183,3 @@ } | ||
// tslint:disable-next-line | ||
var settings = { opacity: annotation.opacity, color: annotation.color, author: this.author, subject: annotation.subject, modifiedDate: annotation.modifiedDate }; | ||
var settings = { opacity: annotation.opacity, color: annotation.color, author: annotation.author, subject: annotation.subject, modifiedDate: annotation.modifiedDate }; | ||
var index = this.pdfViewer.annotationModule.actionCollection[this.pdfViewer.annotationModule.actionCollection.length - 1].index; | ||
@@ -226,3 +249,3 @@ this.pdfViewer.fireAnnotationAdd(pageNumber, index, type, annotation.rect, settings); | ||
// tslint:disable-next-line | ||
TextMarkupAnnotation.prototype.printTextMarkupAnnotations = function (textMarkupAnnotations, pageIndex, stampData, shapeData) { | ||
TextMarkupAnnotation.prototype.printTextMarkupAnnotations = function (textMarkupAnnotations, pageIndex, stampData, shapeData, measureShapeData, stickyData) { | ||
var canvas = createElement('canvas', { id: this.pdfViewer.element.id + '_print_annotation_layer_' + pageIndex }); | ||
@@ -238,9 +261,14 @@ canvas.style.width = 816 + 'px'; | ||
// tslint:disable-next-line | ||
var measureShapeAnnotation = this.getAnnotations(pageIndex, null, '_annotations_shape_measure'); | ||
// tslint:disable-next-line | ||
var stampAnnotation = this.getAnnotations(pageIndex, null, '_annotations_stamp'); | ||
if (stampAnnotation || shapeAnnotation) { | ||
// tslint:disable-next-line | ||
var stickyNoteAnnotation = this.getAnnotations(pageIndex, null, '_annotations_sticky'); | ||
if (stampAnnotation || shapeAnnotation || stickyNoteAnnotation || measureShapeAnnotation) { | ||
this.pdfViewer.renderDrawing(canvas, pageIndex); | ||
} | ||
else { | ||
this.pdfViewer.annotation.renderAnnotations(pageIndex, shapeData, null, null, canvas); | ||
this.pdfViewer.annotation.renderAnnotations(pageIndex, shapeData, measureShapeData, null, canvas); | ||
this.pdfViewer.annotation.stampAnnotationModule.renderStampAnnotations(stampData, pageIndex, canvas); | ||
this.pdfViewer.annotation.stickyNotesAnnotationModule.renderStickyNotesAnnotations(stickyData, pageIndex, canvas); | ||
} | ||
@@ -295,32 +323,34 @@ if (textMarkupannotations) { | ||
var deletedAnnotation = null; | ||
for (var i = 0; i < pageAnnotations.length; i++) { | ||
if (JSON.stringify(this.currentTextMarkupAnnotation) === JSON.stringify(pageAnnotations[i])) { | ||
deletedAnnotation = pageAnnotations.splice(i, 1)[0]; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.addAction(this.selectTextMarkupCurrentPage, i, deletedAnnotation, 'Text Markup Deleted', null); | ||
this.currentAnnotationIndex = i; | ||
this.pdfViewer.annotation.stickyNotesAnnotationModule.findPosition(deletedAnnotation, 'textMarkup'); | ||
var removeDiv = document.getElementById(deletedAnnotation.annotName); | ||
if (removeDiv) { | ||
if (removeDiv.parentElement.childElementCount === 1) { | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAccordionContainer(removeDiv); | ||
if (pageAnnotations) { | ||
for (var i = 0; i < pageAnnotations.length; i++) { | ||
if (JSON.stringify(this.currentTextMarkupAnnotation) === JSON.stringify(pageAnnotations[i])) { | ||
deletedAnnotation = pageAnnotations.splice(i, 1)[0]; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.addAction(this.selectTextMarkupCurrentPage, i, deletedAnnotation, 'Text Markup Deleted', null); | ||
this.currentAnnotationIndex = i; | ||
this.pdfViewer.annotation.stickyNotesAnnotationModule.findPosition(deletedAnnotation, 'textMarkup'); | ||
var removeDiv = document.getElementById(deletedAnnotation.annotName); | ||
if (removeDiv) { | ||
if (removeDiv.parentElement.childElementCount === 1) { | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAccordionContainer(removeDiv); | ||
} | ||
else { | ||
removeDiv.remove(); | ||
} | ||
} | ||
else { | ||
removeDiv.remove(); | ||
} | ||
} | ||
} | ||
} | ||
this.manageAnnotations(pageAnnotations, this.selectTextMarkupCurrentPage); | ||
this.currentTextMarkupAnnotation = null; | ||
this.pdfViewer.annotationModule.renderAnnotations(this.selectTextMarkupCurrentPage, null, null, null); | ||
this.pdfViewerBase.isDocumentEdited = true; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.fireAnnotationRemove(this.selectTextMarkupCurrentPage, this.currentAnnotationIndex, deletedAnnotation.textMarkupAnnotationType); | ||
this.currentAnnotationIndex = null; | ||
this.selectTextMarkupCurrentPage = null; | ||
if (Browser.isDevice) { | ||
this.manageAnnotations(pageAnnotations, this.selectTextMarkupCurrentPage); | ||
this.currentTextMarkupAnnotation = null; | ||
this.pdfViewer.annotationModule.renderAnnotations(this.selectTextMarkupCurrentPage, null, null, null); | ||
this.pdfViewerBase.isDocumentEdited = true; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.toolbarModule.annotationToolbarModule.hideMobileAnnotationToolbar(); | ||
this.pdfViewer.toolbarModule.showToolbar(true); | ||
this.pdfViewer.fireAnnotationRemove(this.selectTextMarkupCurrentPage, this.currentAnnotationIndex, deletedAnnotation.textMarkupAnnotationType); | ||
this.currentAnnotationIndex = null; | ||
this.selectTextMarkupCurrentPage = null; | ||
if (Browser.isDevice) { | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.toolbarModule.annotationToolbarModule.hideMobileAnnotationToolbar(); | ||
this.pdfViewer.toolbarModule.showToolbar(true); | ||
} | ||
} | ||
@@ -346,13 +376,21 @@ } | ||
*/ | ||
TextMarkupAnnotation.prototype.modifyOpacityProperty = function (args) { | ||
TextMarkupAnnotation.prototype.modifyOpacityProperty = function (args, isOpacity) { | ||
if (this.currentTextMarkupAnnotation) { | ||
var pageAnnotations = this.modifyAnnotationProperty('Opacity', args.value / 100, args.name); | ||
this.manageAnnotations(pageAnnotations, this.selectTextMarkupCurrentPage); | ||
this.pdfViewer.annotationModule.renderAnnotations(this.selectTextMarkupCurrentPage, null, null, null); | ||
if (args.name === 'changed') { | ||
this.pdfViewerBase.isDocumentEdited = true; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.fireAnnotationPropertiesChange(this.selectTextMarkupCurrentPage, this.currentAnnotationIndex, this.currentTextMarkupAnnotation.textMarkupAnnotationType, false, true, false, false); | ||
this.currentAnnotationIndex = null; | ||
var pageAnnotations = void 0; | ||
if (isOpacity) { | ||
pageAnnotations = this.modifyAnnotationProperty('Opacity', isOpacity, 'changed'); | ||
} | ||
else { | ||
pageAnnotations = this.modifyAnnotationProperty('Opacity', args.value / 100, args.name); | ||
} | ||
if (pageAnnotations) { | ||
this.manageAnnotations(pageAnnotations, this.selectTextMarkupCurrentPage); | ||
this.pdfViewer.annotationModule.renderAnnotations(this.selectTextMarkupCurrentPage, null, null, null); | ||
if (isOpacity || args.name === 'changed') { | ||
this.pdfViewerBase.isDocumentEdited = true; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.fireAnnotationPropertiesChange(this.selectTextMarkupCurrentPage, this.currentAnnotationIndex, this.currentTextMarkupAnnotation.textMarkupAnnotationType, false, true, false, false); | ||
this.currentAnnotationIndex = null; | ||
} | ||
} | ||
} | ||
@@ -363,18 +401,21 @@ }; | ||
var pageAnnotations = this.getAnnotations(this.selectTextMarkupCurrentPage, null); | ||
for (var i = 0; i < pageAnnotations.length; i++) { | ||
if (JSON.stringify(this.currentTextMarkupAnnotation) === JSON.stringify(pageAnnotations[i])) { | ||
var date = new Date(); | ||
if (property === 'Color') { | ||
pageAnnotations[i].color = value; | ||
if (pageAnnotations) { | ||
for (var i = 0; i < pageAnnotations.length; i++) { | ||
if (JSON.stringify(this.currentTextMarkupAnnotation) === JSON.stringify(pageAnnotations[i])) { | ||
var date = new Date(); | ||
if (property === 'Color') { | ||
pageAnnotations[i].color = value; | ||
} | ||
else { | ||
pageAnnotations[i].opacity = value; | ||
} | ||
pageAnnotations[i].modifiedDate = date.toLocaleString(); | ||
this.currentAnnotationIndex = i; | ||
if (status === null || status === 'changed') { | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.addAction(this.selectTextMarkupCurrentPage, i, this.currentTextMarkupAnnotation, 'Text Markup Property modified', property); | ||
} | ||
this.currentTextMarkupAnnotation = pageAnnotations[i]; | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAnnotationModifiedDate(pageAnnotations[i]); | ||
} | ||
else { | ||
pageAnnotations[i].opacity = value; | ||
} | ||
pageAnnotations[i].modifiedDate = date.toLocaleString(); | ||
this.currentAnnotationIndex = i; | ||
if (status === null || status === 'changed') { | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.addAction(this.selectTextMarkupCurrentPage, i, this.currentTextMarkupAnnotation, 'Text Markup Property modified', property); | ||
} | ||
this.currentTextMarkupAnnotation = pageAnnotations[i]; | ||
} | ||
@@ -406,3 +447,3 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.addAnnotationComments(pageAnnotations[index], annotation.shapeAnnotationType); | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.addAnnotationComments(pageNumber, annotation.shapeAnnotationType); | ||
pageAnnotations.splice(index, 0, annotation); | ||
@@ -420,3 +461,3 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
TextMarkupAnnotation.prototype.undoRedoPropertyChange = function (annotation, pageNumber, index, property) { | ||
TextMarkupAnnotation.prototype.undoRedoPropertyChange = function (annotation, pageNumber, index, property, isUndoAction) { | ||
var pageAnnotations = this.getAnnotations(pageNumber, null); | ||
@@ -434,2 +475,6 @@ if (pageAnnotations) { | ||
} | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.updateAnnotationModifiedDate(annotation, null, true); | ||
if (isUndoAction) { | ||
annotation.modifiedDate = new Date().toLocaleString(); | ||
} | ||
} | ||
@@ -450,3 +495,3 @@ this.clearCurrentAnnotation(); | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.addAnnotationComments(pageAnnotations[index], annotation.shapeAnnotationType); | ||
this.pdfViewer.annotationModule.stickyNotesAnnotationModule.addAnnotationComments(pageNumber, annotation.shapeAnnotationType); | ||
pageAnnotations.push(annotation); | ||
@@ -494,3 +539,12 @@ } | ||
}; | ||
TextMarkupAnnotation.prototype.clearCurrentAnnotationSelection = function (pageNumber) { | ||
/** | ||
* @private | ||
*/ | ||
TextMarkupAnnotation.prototype.clearCurrentAnnotationSelection = function (pageNumber, isSelect) { | ||
if (isSelect) { | ||
this.isAnnotationSelect = true; | ||
} | ||
else { | ||
this.isAnnotationSelect = false; | ||
} | ||
var lowerPageIndex = (pageNumber - 2) >= 0 ? (pageNumber - 2) : 0; | ||
@@ -710,16 +764,19 @@ // tslint:disable-next-line:max-line-length | ||
if (currentAnnot) { | ||
this.selectAnnotation(currentAnnot, canvas); | ||
this.selectAnnotation(currentAnnot, canvas, pageNumber); | ||
this.currentTextMarkupAnnotation = currentAnnot; | ||
this.selectTextMarkupCurrentPage = pageNumber; | ||
this.enableAnnotationPropertiesTool(true); | ||
// tslint:disable-next-line | ||
var accordionExpand = document.getElementById(this.pdfViewer.element.id + '_accordionContainer' + (pageNumber + 1)); | ||
if (accordionExpand) { | ||
accordionExpand.ej2_instances[0].expandItem(true); | ||
var commentPanelDiv = document.getElementById(this.pdfViewer.element.id + '_commantPanel'); | ||
if (commentPanelDiv && commentPanelDiv.style.display === 'block') { | ||
// tslint:disable-next-line | ||
var accordionExpand = document.getElementById(this.pdfViewer.element.id + '_accordionContainer' + (pageNumber + 1)); | ||
if (accordionExpand) { | ||
accordionExpand.ej2_instances[0].expandItem(true); | ||
} | ||
// tslint:disable-next-line | ||
var comments = document.getElementById(currentAnnot.annotName); | ||
if (comments) { | ||
comments.firstChild.click(); | ||
} | ||
} | ||
// tslint:disable-next-line | ||
var comments = document.getElementById(currentAnnot.annotName); | ||
if (comments) { | ||
comments.firstChild.click(); | ||
} | ||
if (this.pdfViewer.toolbarModule) { | ||
@@ -736,3 +793,3 @@ this.pdfViewer.toolbarModule.annotationToolbarModule.isToolbarHidden = true; | ||
else { | ||
if (!this.pdfViewerBase.isClickedOnScrollBar(event)) { | ||
if (!this.pdfViewerBase.isClickedOnScrollBar(event, true)) { | ||
this.clearCurrentAnnotation(); | ||
@@ -754,3 +811,3 @@ this.clearCurrentAnnotationSelection(pageNumber); | ||
if (currentAnnot) { | ||
this.selectAnnotation(currentAnnot, touchCanvas); | ||
this.selectAnnotation(currentAnnot, touchCanvas, pageNumber); | ||
this.currentTextMarkupAnnotation = currentAnnot; | ||
@@ -814,3 +871,3 @@ this.selectTextMarkupCurrentPage = pageNumber; | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.annotationModule.showPopupNote(event, annotation.color, this.author, annotation.note, annotation.textMarkupAnnotationType); | ||
this.pdfViewer.annotationModule.showPopupNote(event, annotation.color, annotation.author, annotation.note, annotation.textMarkupAnnotationType); | ||
} | ||
@@ -905,2 +962,10 @@ }; | ||
TextMarkupAnnotation.prototype.selectAnnotation = function (annotation, canvas, pageNumber) { | ||
if (this.pdfViewer.selectedItems.annotations[0]) { | ||
this.pdfViewer.clearSelection(this.pdfViewer.selectedItems.annotations[0].pageIndex); | ||
this.pdfViewer.clearSelection(this.selectTextMarkupCurrentPage); | ||
} | ||
var isCurrentTextMarkup = false; | ||
if (!this.currentTextMarkupAnnotation) { | ||
isCurrentTextMarkup = true; | ||
} | ||
if (!isNaN(pageNumber)) { | ||
@@ -920,2 +985,7 @@ this.currentTextMarkupAnnotation = annotation; | ||
} | ||
if (annotation.annotName !== '') { | ||
if (isCurrentTextMarkup) { | ||
this.pdfViewer.annotationModule.selectAnnotation(annotation.annotName, this.selectTextMarkupCurrentPage, annotation); | ||
} | ||
} | ||
}; | ||
@@ -974,3 +1044,3 @@ TextMarkupAnnotation.prototype.drawAnnotationSelectRect = function (canvas, x, y, width, height) { | ||
if (canvas) { | ||
this.selectAnnotation(this.currentTextMarkupAnnotation, canvas); | ||
this.selectAnnotation(this.currentTextMarkupAnnotation, canvas, this.selectTextMarkupCurrentPage); | ||
} | ||
@@ -1054,10 +1124,14 @@ } | ||
var annotationName = this.pdfViewer.annotation.createGUID(); | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('textMarkup', pageNumber + 1); | ||
document.getElementById(commentsDivid).id = annotationName; | ||
var commentsDivid = this.pdfViewer.annotation.stickyNotesAnnotationModule.addComments('textMarkup', pageNumber + 1, type); | ||
if (commentsDivid) { | ||
document.getElementById(commentsDivid).id = annotationName; | ||
} | ||
var annotation = { | ||
// tslint:disable-next-line:max-line-length | ||
textMarkupAnnotationType: type, color: color, opacity: opacity, bounds: bounds, author: author, subject: subject, modifiedDate: modifiedDate, note: note, rect: rect, | ||
annotName: annotationName, comments: [], review: { state: '', stateModel: '', author: 'Author', modifiedDate: modifiedDate }, shapeAnnotationType: 'textMarkup' | ||
annotName: annotationName, comments: [], review: { state: '', stateModel: '', author: author, modifiedDate: modifiedDate }, shapeAnnotationType: 'textMarkup' | ||
}; | ||
document.getElementById(annotationName).addEventListener('mouseup', this.annotationDivSelect(annotation, pageNumber)); | ||
if (document.getElementById(annotationName)) { | ||
document.getElementById(annotationName).addEventListener('mouseup', this.annotationDivSelect(annotation, pageNumber)); | ||
} | ||
var storedIndex = this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotation, '_annotations_textMarkup'); | ||
@@ -1100,2 +1174,14 @@ this.pdfViewer.annotationModule.addAction(pageNumber, storedIndex, annotation, 'Text Markup Added', null); | ||
*/ | ||
// tslint:disable-next-line | ||
TextMarkupAnnotation.prototype.saveImportedTextMarkupAnnotations = function (annotation, pageNumber) { | ||
var annotationObject = null; | ||
annotation.Author = this.pdfViewer.annotationModule.updateAnnotationAuthor('textMarkup', annotation.Subject); | ||
// tslint:disable-next-line:max-line-length | ||
annotationObject = { textMarkupAnnotationType: annotation.TextMarkupAnnotationType, color: annotation.Color, opacity: annotation.Opacity, bounds: annotation.Bounds, author: annotation.Author, subject: annotation.Subject, modifiedDate: annotation.ModifiedDate, note: annotation.Note, rect: annotation.Rect, | ||
annotName: annotation.AnnotName, comments: this.pdfViewer.annotationModule.getAnnotationComments(annotation.Comments, annotation, annotation.Author), review: { state: annotation.State, stateModel: annotation.StateModel, modifiedDate: annotation.ModifiedDate, author: annotation.Author }, shapeAnnotationType: 'textMarkup' }; | ||
this.pdfViewer.annotationModule.storeAnnotations(pageNumber, annotationObject, '_annotations_textMarkup'); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
TextMarkupAnnotation.prototype.clear = function () { | ||
@@ -1102,0 +1188,0 @@ window.sessionStorage.removeItem(this.pdfViewerBase.documentId + '_annotations_textMarkup'); |
@@ -22,2 +22,6 @@ import { ContextMenu as Context } from '@syncfusion/ej2-navigations'; | ||
*/ | ||
previousAction: string; | ||
/** | ||
* @private | ||
*/ | ||
constructor(pdfViewer: PdfViewer, pdfViewerBase: PdfViewerBase); | ||
@@ -24,0 +28,0 @@ /** |
@@ -23,2 +23,4 @@ import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
{ text: this.pdfViewer.localeObj.getConstant('Scale Ratio'), iconCss: 'e-pv-scale-ratio-icon' }, | ||
{ separator: true, id: pdfViewer.element.id + '_context_menu_comment_separator' }, | ||
{ text: this.pdfViewer.localeObj.getConstant('Comment'), iconCss: 'e-pv-comment-icon' }, | ||
{ separator: true, id: pdfViewer.element.id + '_context_menu_separator' }, | ||
@@ -68,11 +70,13 @@ { text: this.pdfViewer.localeObj.getConstant('Properties') } | ||
this.pdfViewer.localeObj.getConstant('Highlight context'), this.pdfViewer.localeObj.getConstant('Underline context'), this.pdfViewer.localeObj.getConstant('Strikethrough context'), | ||
this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Comment'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.remove('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.remove('e-menu-hide'); | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.enableItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Copy'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context')], true); | ||
if (this.pdfViewer.textSelectionModule) { | ||
if (this.pdfViewer.textSelectionModule || this.pdfViewerBase.isShapeBasedAnnotationsEnabled()) { | ||
if (args.event) { | ||
var isClickWithinSelectionBounds = this.isClickWithinSelectionBounds(args.event); | ||
// tslint:disable-next-line:max-line-length | ||
if (isClickWithinSelectionBounds) { | ||
if (isClickWithinSelectionBounds && this.pdfViewer.textSelectionModule) { | ||
// tslint:disable-next-line:max-line-length | ||
@@ -87,8 +91,8 @@ if ((!args.event.target.classList.contains('e-pv-maintaincontent') && args.event.target.classList.contains('e-pv-text') || args.event.target.classList.contains('e-pv-text-layer'))) { | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Comment'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.add('e-menu-hide'); | ||
// tslint:disable-next-line:max-line-length | ||
} | ||
else if (this.pdfViewer.selectedItems.annotations.length !== 0 && this.pdfViewer.selectedItems.annotations[0].shapeAnnotationType !== 'Stamp' | ||
&& this.pdfViewer.selectedItems.annotations[0].shapeAnnotationType !== 'Image') { | ||
else if (this.pdfViewer.selectedItems.annotations.length !== 0) { | ||
this.onOpeningForShape(true); | ||
@@ -98,13 +102,24 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
if (this.pdfViewer.annotation.isShapeCopied && (args.event.target.classList.contains('e-pv-text-layer') || | ||
args.event.target.classList.contains('e-pv-text'))) { | ||
if (this.pdfViewer.annotation && this.pdfViewer.annotation.isShapeCopied && (args.event.target.classList.contains('e-pv-text-layer') || | ||
args.event.target.classList.contains('e-pv-text')) && !this.pdfViewer.annotationModule.textMarkupAnnotationModule.currentTextMarkupAnnotation) { | ||
this.onOpeningForShape(false); | ||
// tslint:disable-next-line:max-line-length | ||
} | ||
else if (this.pdfViewer.annotationModule.measureAnnotationModule.currentAnnotationMode !== '') { | ||
else if (this.pdfViewerBase.isCalibrateAnnotationModule() && this.pdfViewer.annotationModule.measureAnnotationModule.currentAnnotationMode !== '') { | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Highlight context'), this.pdfViewer.localeObj.getConstant('Underline context'), this.pdfViewer.localeObj.getConstant('Strikethrough context'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.remove('e-menu-hide'); | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.enableItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Copy'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context')], false); | ||
this.contextMenuObj.enableItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Copy'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Comment')], false); | ||
} | ||
else if (this.pdfViewer.annotationModule.textMarkupAnnotationModule.currentTextMarkupAnnotation) { | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Highlight context'), this.pdfViewer.localeObj.getConstant('Underline context'), this.pdfViewer.localeObj.getConstant('Strikethrough context'), this.pdfViewer.localeObj.getConstant('Properties'), this.pdfViewer.localeObj.getConstant('Cut'), | ||
this.pdfViewer.localeObj.getConstant('Copy'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Scale Ratio')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.remove('e-menu-hide'); | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.showItems([this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Comment')], false); | ||
} | ||
else { | ||
@@ -115,2 +130,8 @@ args.cancel = true; | ||
} | ||
else if (this.pdfViewer.textSelectionModule && (this.pdfViewer.contextMenuOption === 'MouseUp')) { | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Comment'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.add('e-menu-hide'); | ||
} | ||
else { | ||
@@ -127,5 +148,8 @@ if (this.pdfViewer.selectedItems.annotations.length === 0) { | ||
} | ||
if (this.pdfViewer.contextMenuOption === 'None') { | ||
args.cancel = true; | ||
} | ||
}; | ||
ContextMenu.prototype.onOpeningForShape = function (isProp) { | ||
if (this.pdfViewer.annotation.isShapeCopied) { | ||
if (this.pdfViewer.annotation && this.pdfViewer.annotation.isShapeCopied) { | ||
this.contextMenuObj.enableItems([this.pdfViewer.localeObj.getConstant('Paste')], true); | ||
@@ -151,4 +175,6 @@ } | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Copy'), | ||
this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Properties'), this.pdfViewer.localeObj.getConstant('Comment')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.add('e-menu-hide'); | ||
} | ||
@@ -159,14 +185,16 @@ }; | ||
var isWithin = false; | ||
var bounds = this.pdfViewer.textSelectionModule.getCurrentSelectionBounds(this.pdfViewerBase.currentPageNumber - 1); | ||
if (bounds) { | ||
var currentBound = bounds; | ||
if (this.getHorizontalValue(currentBound.left) < event.clientX && this.getHorizontalValue(currentBound.right) > | ||
event.clientX && this.getVerticalValue(currentBound.top) < event.clientY && | ||
this.getVerticalValue(currentBound.bottom) > event.clientY) { | ||
if (this.pdfViewer.textSelectionModule) { | ||
var bounds = this.pdfViewer.textSelectionModule.getCurrentSelectionBounds(this.pdfViewerBase.currentPageNumber - 1); | ||
if (bounds) { | ||
var currentBound = bounds; | ||
if (this.getHorizontalValue(currentBound.left) < event.clientX && this.getHorizontalValue(currentBound.right) > | ||
event.clientX && this.getVerticalValue(currentBound.top) < event.clientY && | ||
this.getVerticalValue(currentBound.bottom) > event.clientY) { | ||
isWithin = true; | ||
} | ||
} | ||
if ((Browser.isIE || Browser.info.name === 'edge') && bounds) { | ||
isWithin = true; | ||
} | ||
} | ||
if ((Browser.isIE || Browser.info.name === 'edge') && bounds) { | ||
isWithin = true; | ||
} | ||
return isWithin; | ||
@@ -203,2 +231,3 @@ }; | ||
this.pdfViewer.copy(); | ||
this.previousAction = 'Copy'; | ||
} | ||
@@ -236,2 +265,3 @@ break; | ||
this.pdfViewer.clearSelection(pageIndex); | ||
this.previousAction = 'Cut'; | ||
} | ||
@@ -241,2 +271,3 @@ break; | ||
this.pdfViewer.paste(); | ||
this.previousAction = 'Paste'; | ||
break; | ||
@@ -249,6 +280,34 @@ case this.pdfViewer.localeObj.getConstant('Delete Context'): | ||
case this.pdfViewer.localeObj.getConstant('Scale Ratio'): | ||
if (this.pdfViewer.annotation && this.pdfViewer.annotation.measureAnnotationModule) { | ||
if (this.pdfViewerBase.isCalibrateAnnotationModule()) { | ||
this.pdfViewer.annotation.measureAnnotationModule.createScaleRatioWindow(); | ||
} | ||
break; | ||
case this.pdfViewer.localeObj.getConstant('Comment'): | ||
if (this.pdfViewer.annotation) { | ||
this.pdfViewer.annotation.showCommentsPanel(); | ||
if (this.pdfViewer.selectedItems.annotations.length !== 0 || | ||
this.pdfViewer.annotationModule.textMarkupAnnotationModule.currentTextMarkupAnnotation) { | ||
// tslint:disable-next-line | ||
var currentAnnotation = void 0; | ||
if (this.pdfViewer.annotationModule.textMarkupAnnotationModule.currentTextMarkupAnnotation) { | ||
currentAnnotation = this.pdfViewer.annotationModule.textMarkupAnnotationModule.currentTextMarkupAnnotation; | ||
} | ||
else { | ||
currentAnnotation = this.pdfViewer.selectedItems.annotations[0]; | ||
} | ||
// tslint:disable-next-line | ||
var accordionExpand = document.getElementById(this.pdfViewer.element.id + '_accordionContainer' + this.pdfViewer.currentPageNumber); | ||
if (accordionExpand) { | ||
accordionExpand.ej2_instances[0].expandItem(true); | ||
} | ||
// tslint:disable-next-line | ||
var commentsDiv = document.getElementById(currentAnnotation.annotName); | ||
if (commentsDiv) { | ||
if (!commentsDiv.classList.contains('e-pv-comments-border')) { | ||
commentsDiv.firstChild.click(); | ||
} | ||
} | ||
} | ||
} | ||
break; | ||
default: | ||
@@ -262,2 +321,3 @@ break; | ||
ContextMenu.prototype.destroy = function () { | ||
this.previousAction = ''; | ||
this.contextMenuObj.destroy(); | ||
@@ -264,0 +324,0 @@ }; |
@@ -57,2 +57,6 @@ import { BaseEventArgs } from '@syncfusion/ej2-base'; | ||
errorMessage: string; | ||
/** | ||
* Action name in which the failure is thrown. | ||
*/ | ||
action: string; | ||
} | ||
@@ -118,4 +122,17 @@ /** | ||
hyperlink: string; | ||
/** | ||
* Defines the current hyperlink element. | ||
*/ | ||
hyperlinkElement: HTMLAnchorElement; | ||
} | ||
/** | ||
* This event arguments provides the necessary information about hyperlink hover event. | ||
*/ | ||
export interface HyperlinkMouseOverArgs extends BaseEventArgs { | ||
/** | ||
* Defines the current hyperlink element. | ||
*/ | ||
hyperlinkElement: HTMLAnchorElement; | ||
} | ||
/** | ||
* This event arguments provides the necessary information about annotation add event. | ||
@@ -240,1 +257,18 @@ */ | ||
} | ||
/** | ||
* This event arguments provides the necessary information about annotation select event. | ||
*/ | ||
export interface AnnotationSelectEventArgs extends BaseEventArgs { | ||
/** | ||
* Defines the id of the annotation selected in the page of the PDF document. | ||
*/ | ||
annotationId: string; | ||
/** | ||
* Defines the page number in which the annotation is selected. | ||
*/ | ||
pageIndex: number; | ||
/** | ||
* Defines the annotation selected in the PDF document. | ||
*/ | ||
annotation: any; | ||
} |
@@ -31,2 +31,5 @@ import { PdfViewer } from '../index'; | ||
private isThumbnail; | ||
private annotationInputElement; | ||
private annotationContextMenu; | ||
private annotationMenuObj; | ||
/** | ||
@@ -95,6 +98,18 @@ * @private | ||
private createCommentPanelTitleContainer; | ||
private closeCommentPanelContainer; | ||
private openAnnotationContextMenu; | ||
/** | ||
* @private | ||
*/ | ||
createAnnotationContextMenu(): void; | ||
private annotationMenuItemSelect; | ||
private createFileElement; | ||
private importAnnotationIconClick; | ||
private loadImportAnnotation; | ||
/** | ||
* @private | ||
*/ | ||
closeCommentPanelContainer(): void; | ||
/** | ||
* @private | ||
*/ | ||
createNavigationPaneMobile(option: string): void; | ||
@@ -203,3 +218,7 @@ private initiateSearchBox; | ||
clear(): void; | ||
/** | ||
* @private | ||
*/ | ||
destroy(): void; | ||
getModuleName(): string; | ||
} |
import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
import { Toolbar as Tool } from '@syncfusion/ej2-navigations'; | ||
import { Toolbar as Tool, ContextMenu as Context, } from '@syncfusion/ej2-navigations'; | ||
import { Tooltip } from '@syncfusion/ej2-popups'; | ||
@@ -20,2 +20,3 @@ import { Toast } from '@syncfusion/ej2-notifications'; | ||
this.isThumbnail = false; | ||
this.annotationContextMenu = []; | ||
/** | ||
@@ -41,2 +42,23 @@ * @private | ||
this.isThumbnailOpen = false; | ||
// tslint:disable-next-line | ||
this.loadImportAnnotation = function (args) { | ||
// tslint:disable-next-line | ||
var upoadedFiles = args.target.files; | ||
if (args.target.files[0] !== null) { | ||
var uploadedFile = upoadedFiles[0]; | ||
if (uploadedFile) { | ||
var reader = new FileReader(); | ||
reader.readAsDataURL(uploadedFile); | ||
// tslint:disable-next-line | ||
reader.onload = function (e) { | ||
if (e.currentTarget.result) { | ||
var importFile = e.currentTarget.result.split(',')[1]; | ||
// tslint:disable-next-line | ||
var annotationData = atob(importFile); | ||
_this.pdfViewerBase.importAnnotations(JSON.parse(annotationData)); | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
this.resizeIconMouseOver = function (event) { | ||
@@ -350,2 +372,3 @@ event.srcElement.style.cursor = 'default'; | ||
} | ||
this.commentPanelContainer.style.bottom = 0 + 'px'; | ||
this.createCommentPanelTitleContainer(); | ||
@@ -356,2 +379,3 @@ this.commentPanelContainer.style.display = 'none'; | ||
this.commentPanelContainer.appendChild(this.commentsContentContainer); | ||
this.createFileElement(this.commentPanelContainer); | ||
}; | ||
@@ -364,12 +388,75 @@ NavigationPane.prototype.createCommentPanelTitleContainer = function () { | ||
commentpanelTilte.innerText = this.pdfViewer.localeObj.getConstant('Comments'); | ||
var closeButton = createElement('button', { id: this.pdfViewer.element.id + '_close_btn' }); | ||
closeButton.className = 'e-btn e-pv-tbar-btn e-pv-comment-panel-title-close-div e-btn'; | ||
var annotationButton = createElement('button', { id: this.pdfViewer.element.id + '_annotations_btn' }); | ||
annotationButton.className = 'e-btn e-pv-tbar-btn e-pv-comment-panel-title-close-div e-btn'; | ||
// tslint:disable-next-line:max-line-length | ||
var closeButtonSpan = createElement('span', { id: this.pdfViewer.element.id + '_close' + '_icon', className: 'e-pv-title-close-icon e-pv-icon' }); | ||
closeButton.appendChild(closeButtonSpan); | ||
var moreOptionButtonSpan = createElement('span', { id: this.pdfViewer.element.id + '_annotation_more_icon', className: 'e-pv-more-icon e-pv-icon' }); | ||
annotationButton.appendChild(moreOptionButtonSpan); | ||
commentPanelTitleContainer.appendChild(commentpanelTilte); | ||
commentPanelTitleContainer.appendChild(closeButton); | ||
commentPanelTitleContainer.appendChild(annotationButton); | ||
this.commentPanelContainer.appendChild(commentPanelTitleContainer); | ||
closeButton.addEventListener('click', this.closeCommentPanelContainer.bind(this, NavigationPane)); | ||
this.createAnnotationContextMenu(); | ||
annotationButton.addEventListener('click', this.openAnnotationContextMenu.bind(this)); | ||
}; | ||
// tslint:disable-next-line | ||
NavigationPane.prototype.openAnnotationContextMenu = function (event) { | ||
this.annotationMenuObj.open(event.clientY, event.clientX, event.currentTarget); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
NavigationPane.prototype.createAnnotationContextMenu = function () { | ||
// tslint:disable-next-line:max-line-length | ||
this.annotationContextMenu = [ | ||
{ text: this.pdfViewer.localeObj.getConstant('Export Annotations') }, | ||
{ text: this.pdfViewer.localeObj.getConstant('Import Annotations') } | ||
]; | ||
var annotationMenuElement = createElement('ul', { id: this.pdfViewer.element.id + '_annotation_context_menu' }); | ||
this.pdfViewer.element.appendChild(annotationMenuElement); | ||
this.annotationMenuObj = new Context({ | ||
target: '#' + this.pdfViewer.element.id + '_annotations_btn', items: this.annotationContextMenu, | ||
select: this.annotationMenuItemSelect.bind(this), | ||
}); | ||
if (this.pdfViewer.enableRtl) { | ||
this.annotationMenuObj.enableRtl = true; | ||
} | ||
this.annotationMenuObj.appendTo(annotationMenuElement); | ||
if (Browser.isDevice) { | ||
this.annotationMenuObj.animationSettings.effect = 'ZoomIn'; | ||
} | ||
else { | ||
this.annotationMenuObj.animationSettings.effect = 'SlideDown'; | ||
} | ||
}; | ||
// tslint:disable-next-line | ||
NavigationPane.prototype.annotationMenuItemSelect = function (args) { | ||
if (args.item) { | ||
switch (args.item.text) { | ||
case this.pdfViewer.localeObj.getConstant('Export Annotations'): | ||
this.pdfViewerBase.exportAnnotations(); | ||
break; | ||
case this.pdfViewer.localeObj.getConstant('Import Annotations'): | ||
this.importAnnotationIconClick(args); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
}; | ||
NavigationPane.prototype.createFileElement = function (toolbarElement) { | ||
// tslint:disable-next-line:max-line-length | ||
this.annotationInputElement = createElement('input', { id: this.pdfViewer.element.id + '_annotationUploadElement', styles: 'position:fixed; left:-100em', attrs: { 'type': 'file' } }); | ||
this.annotationInputElement.setAttribute('accept', '.json'); | ||
toolbarElement.appendChild(this.annotationInputElement); | ||
this.annotationInputElement.addEventListener('change', this.loadImportAnnotation); | ||
}; | ||
NavigationPane.prototype.importAnnotationIconClick = function (args) { | ||
this.annotationInputElement.click(); | ||
if (Browser.isDevice) { | ||
args.originalEvent.target.blur(); | ||
this.pdfViewerBase.focusViewerContainer(); | ||
} | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
NavigationPane.prototype.closeCommentPanelContainer = function () { | ||
@@ -382,17 +469,17 @@ var proxy = this; | ||
commentPanel.style.display = 'none'; | ||
} | ||
if (viewerContainer) { | ||
if (this.pdfViewer.enableRtl) { | ||
viewerContainer.style.left = proxy.getViewerContainerRight() + 'px'; | ||
if (viewerContainer) { | ||
if (this.pdfViewer.enableRtl) { | ||
viewerContainer.style.left = proxy.getViewerContainerRight() + 'px'; | ||
} | ||
else { | ||
viewerContainer.style.right = proxy.getViewerContainerRight() + 'px'; | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
viewerContainer.style.width = (proxy.pdfViewer.element.clientWidth - proxy.getViewerContainerLeft() - proxy.getViewerContainerRight()) + 'px'; | ||
pageContainer.style.width = (proxy.pdfViewerBase.viewerContainer.offsetWidth - proxy.getViewerContainerScrollbarWidth()) + 'px'; | ||
} | ||
else { | ||
viewerContainer.style.right = proxy.getViewerContainerRight() + 'px'; | ||
if (proxy.pdfViewerBase) { | ||
proxy.pdfViewerBase.updateZoomValue(); | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
viewerContainer.style.width = (proxy.pdfViewer.element.clientWidth - proxy.getViewerContainerLeft() - proxy.getViewerContainerRight()) + 'px'; | ||
pageContainer.style.width = (proxy.pdfViewerBase.viewerContainer.offsetWidth - proxy.getViewerContainerScrollbarWidth()) + 'px'; | ||
} | ||
if (proxy.pdfViewerBase) { | ||
proxy.pdfViewerBase.updateZoomValue(); | ||
} | ||
}; | ||
@@ -750,3 +837,4 @@ /** | ||
var proxy = this; | ||
if (proxy.sideBarContentContainer) { | ||
var sideBarContentContainer = proxy.pdfViewerBase.getElement('_sideBarContentContainer'); | ||
if (sideBarContentContainer) { | ||
proxy.sideBarContentContainer.style.display = 'none'; | ||
@@ -886,2 +974,8 @@ if (this.pdfViewer.enableRtl) { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
NavigationPane.prototype.destroy = function () { | ||
this.annotationMenuObj.destroy(); | ||
}; | ||
NavigationPane.prototype.getModuleName = function () { | ||
@@ -888,0 +982,0 @@ return 'NavigationPane'; |
@@ -16,2 +16,3 @@ import { PdfViewer, TextLayer, ContextMenu } from '../index'; | ||
top: number; | ||
rotation?: number; | ||
} | ||
@@ -27,2 +28,20 @@ /** | ||
/** | ||
* The `IAnnotationCollection` module is used to handle page size property of PDF viewer. | ||
* @hidden | ||
*/ | ||
export interface IAnnotationCollection { | ||
textMarkupAnnotation: object; | ||
shapeAnnotation: object; | ||
measureShapeAnnotation: object; | ||
stampAnnotations: object; | ||
stickyNotesAnnotation: object; | ||
} | ||
/** | ||
* @hidden | ||
*/ | ||
interface ICustomStampItems { | ||
customStampName: string; | ||
customStampImageSource: string; | ||
} | ||
/** | ||
* The `PdfViewerBase` module is used to handle base methods of PDF viewer. | ||
@@ -62,6 +81,9 @@ * @hidden | ||
private unload; | ||
private isDocumentLoaded; | ||
/** | ||
* @private | ||
*/ | ||
isDocumentLoaded: boolean; | ||
/** | ||
* @private | ||
*/ | ||
isDocumentEdited: boolean; | ||
@@ -75,2 +97,6 @@ /** | ||
*/ | ||
jsonDocumentId: string; | ||
/** | ||
* @private | ||
*/ | ||
renderedPagesList: number[]; | ||
@@ -107,3 +133,2 @@ /** | ||
private document; | ||
private waitingPopup; | ||
/** | ||
@@ -135,3 +160,2 @@ * @private | ||
private printMainContainer; | ||
private printWaitingPopup; | ||
/** | ||
@@ -202,5 +226,18 @@ * @private | ||
private virtualLoadRequestHandler; | ||
private exportAnnotationRequestHandler; | ||
private importAnnotationRequestHandler; | ||
private annotationPageList; | ||
private importPageList; | ||
/** | ||
* @private | ||
*/ | ||
importedAnnotation: any; | ||
/** | ||
* @private | ||
*/ | ||
isImportAction: boolean; | ||
private isImportedAnnotation; | ||
/** | ||
* @private | ||
*/ | ||
tool: ToolBase; | ||
@@ -245,2 +282,11 @@ action: string; | ||
isDynamicStamp: boolean; | ||
private isMixedSizeDocument; | ||
/** | ||
* @private | ||
*/ | ||
customStampCollection: ICustomStampItems[]; | ||
/** | ||
* @private | ||
*/ | ||
isAlreadyAdded: boolean; | ||
constructor(viewer: PdfViewer); | ||
@@ -258,2 +304,15 @@ /** | ||
private setMaximumHeight; | ||
/** | ||
* @private | ||
*/ | ||
updateWidth(): void; | ||
/** | ||
* @private | ||
*/ | ||
updateHeight(): void; | ||
/** | ||
* @private | ||
*/ | ||
updateViewerContainer(): void; | ||
private updateViewerContainerSize; | ||
private mobileScrollContainerEnd; | ||
@@ -314,2 +373,7 @@ private createAjaxRequest; | ||
*/ | ||
saveAsBlob(): Promise<Blob>; | ||
private saveAsBlobRequest; | ||
/** | ||
* @private | ||
*/ | ||
clear(isTriggerEvent: boolean): void; | ||
@@ -428,2 +492,4 @@ /** | ||
private downloadDocument; | ||
private downloadExportAnnotationJson; | ||
private constructJsonDownload; | ||
private createRequestForDownload; | ||
@@ -434,2 +500,6 @@ private createRequestForRender; | ||
*/ | ||
onControlError(status: number, errorMessage: string, action: string): void; | ||
/** | ||
* @private | ||
*/ | ||
getStoredData(pageIndex: number): any; | ||
@@ -453,3 +523,3 @@ /** | ||
*/ | ||
isClickedOnScrollBar(event: MouseEvent): boolean; | ||
isClickedOnScrollBar(event: MouseEvent, isNeedToSet?: boolean): boolean; | ||
private setScrollDownValue; | ||
@@ -506,2 +576,14 @@ /** | ||
isCalibrateAnnotationModule(): boolean; | ||
/** | ||
* @private | ||
*/ | ||
isStampAnnotationModule(): boolean; | ||
/** | ||
* @private | ||
*/ | ||
isCommentAnnotationModule(): boolean; | ||
/** | ||
* @private | ||
*/ | ||
isShapeBasedAnnotationsEnabled(): boolean; | ||
/** @private */ | ||
@@ -530,2 +612,22 @@ getMousePosition(e: MouseEvent | PointerEvent | TouchEvent): PointModel; | ||
diagramMouseDown(evt: MouseEvent | TouchEvent): void; | ||
/** | ||
* @private | ||
*/ | ||
importAnnotations(importData: any): void; | ||
/** | ||
* @private | ||
*/ | ||
exportAnnotations(): void; | ||
private createRequestForExportAnnotations; | ||
private createRequestForImportAnnotations; | ||
private reRenderAnnotations; | ||
private drawPageAnnotations; | ||
private saveImportedAnnotations; | ||
private savePageAnnotations; | ||
/** | ||
* @private | ||
*/ | ||
createAnnotationJsonData(): any; | ||
private combineImportedData; | ||
} | ||
export {}; |
@@ -10,2 +10,3 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private notifyDialog; | ||
private isMessageBoxOpen; | ||
private textBoundsArray; | ||
@@ -15,2 +16,6 @@ /** | ||
*/ | ||
characterBound: any[]; | ||
/** | ||
* @private | ||
*/ | ||
constructor(pdfViewer: PdfViewer, pdfViewerBase: PdfViewerBase); | ||
@@ -40,2 +45,3 @@ /** | ||
clearTextLayers(): void; | ||
private removeElement; | ||
/** | ||
@@ -42,0 +48,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import { createElement } from '@syncfusion/ej2-base'; | ||
import { createElement, isNullOrUndefined, Browser } from '@syncfusion/ej2-base'; | ||
import { Dialog } from '@syncfusion/ej2-popups'; | ||
@@ -15,2 +15,7 @@ /** | ||
this.textBoundsArray = []; | ||
/** | ||
* @private | ||
*/ | ||
// tslint:disable-next-line | ||
this.characterBound = []; | ||
this.closeNotification = function () { | ||
@@ -90,2 +95,5 @@ _this.notifyDialog.hide(); | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageNumber + '_' + i); | ||
if (isNullOrUndefined(textDiv)) { | ||
break; | ||
} | ||
if (textBounds) { | ||
@@ -120,2 +128,5 @@ bounds = textBounds[i]; | ||
} | ||
if (this.pdfViewer.textSearch) { | ||
this.pdfViewer.textSearch.resizeSearchElements(pageNumber); | ||
} | ||
}; | ||
@@ -228,3 +239,3 @@ TextLayer.prototype.applyTextRotation = function (scale, textDiv, rotation, textRotation) { | ||
higherPageValue = (higherPageValue < this.pdfViewerBase.pageCount) ? higherPageValue : (this.pdfViewerBase.pageCount - 1); | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -236,13 +247,26 @@ textLayers[i].style.display = 'block'; | ||
if (!(((lowerPageValue + 1) <= pageNumber) && (pageNumber <= (higherPageValue - 1)))) { | ||
textLayers[i].remove(); | ||
this.removeElement(textLayers[i]); | ||
} | ||
} | ||
else if (this.pdfViewerBase.getPinchZoomed()) { | ||
textLayers[i].remove(); | ||
this.removeElement(textLayers[i]); | ||
} | ||
else { | ||
textLayers[i].remove(); | ||
this.removeElement(textLayers[i]); | ||
} | ||
} | ||
}; | ||
TextLayer.prototype.removeElement = function (element) { | ||
if (Browser.isIE) { | ||
if (element.parentElement) { | ||
element.parentElement.removeChild(element); | ||
} | ||
else if (element.parentNode) { | ||
element.parentNode.removeChild(element); | ||
} | ||
} | ||
else { | ||
element.remove(); | ||
} | ||
}; | ||
/** | ||
@@ -335,3 +359,3 @@ * @private | ||
TextLayer.prototype.clearDivSelection = function () { | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -370,3 +394,3 @@ var childNodes = textLayers[i].childNodes; | ||
TextLayer.prototype.modifyTextCursor = function (isAdd) { | ||
var textLayerList = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayerList = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayerList.length; i++) { | ||
@@ -460,24 +484,28 @@ var childNodes = textLayerList[i].childNodes; | ||
var _this = this; | ||
// tslint:disable-next-line:max-line-length | ||
var popupElement = createElement('div', { id: this.pdfViewer.element.id + '_notify', className: 'e-pv-notification-popup' }); | ||
this.pdfViewerBase.viewerContainer.appendChild(popupElement); | ||
this.notifyDialog = new Dialog({ | ||
showCloseIcon: true, closeOnEscape: false, isModal: true, header: this.pdfViewer.localeObj.getConstant('PdfViewer'), | ||
buttons: [{ | ||
buttonModel: { content: this.pdfViewer.localeObj.getConstant('OK'), isPrimary: true }, | ||
click: this.closeNotification.bind(this) | ||
}], | ||
content: '<div class="e-pv-notification-popup-content" tabindex = "0">' + text + '</div>', target: this.pdfViewer.element, | ||
beforeClose: function () { | ||
_this.notifyDialog.destroy(); | ||
_this.pdfViewer.element.removeChild(popupElement); | ||
if (_this.pdfViewer.textSearchModule) { | ||
_this.pdfViewer.textSearch.isMessagePopupOpened = false; | ||
if (!this.isMessageBoxOpen) { | ||
// tslint:disable-next-line:max-line-length | ||
var popupElement_1 = createElement('div', { id: this.pdfViewer.element.id + '_notify', className: 'e-pv-notification-popup' }); | ||
this.pdfViewerBase.viewerContainer.appendChild(popupElement_1); | ||
this.notifyDialog = new Dialog({ | ||
showCloseIcon: true, closeOnEscape: false, isModal: true, header: this.pdfViewer.localeObj.getConstant('PdfViewer'), | ||
buttons: [{ | ||
buttonModel: { content: this.pdfViewer.localeObj.getConstant('OK'), isPrimary: true }, | ||
click: this.closeNotification.bind(this) | ||
}], | ||
content: '<div class="e-pv-notification-popup-content" tabindex = "0">' + text + '</div>', target: this.pdfViewer.element, | ||
beforeClose: function () { | ||
_this.notifyDialog.destroy(); | ||
_this.pdfViewer.element.removeChild(popupElement_1); | ||
if (_this.pdfViewer.textSearchModule) { | ||
_this.pdfViewer.textSearch.isMessagePopupOpened = false; | ||
} | ||
_this.isMessageBoxOpen = false; | ||
} | ||
}); | ||
if (this.pdfViewer.enableRtl) { | ||
this.notifyDialog.enableRtl = true; | ||
} | ||
}); | ||
if (this.pdfViewer.enableRtl) { | ||
this.notifyDialog.enableRtl = true; | ||
this.notifyDialog.appendTo(popupElement_1); | ||
this.isMessageBoxOpen = true; | ||
} | ||
this.notifyDialog.appendTo(popupElement); | ||
}; | ||
@@ -484,0 +512,0 @@ return TextLayer; |
@@ -28,2 +28,6 @@ /** | ||
*/ | ||
export declare type CalibrationUnit = 'pt' | 'in' | 'mm' | 'cm' | 'p'; | ||
export declare type CalibrationUnit = 'pt' | 'in' | 'mm' | 'cm' | 'p' | 'ft'; | ||
/** | ||
* Enum unit for ContextMenu Actions | ||
*/ | ||
export declare type ContextMenuAction = 'None' | 'MouseUp' | 'RightClick'; |
@@ -47,3 +47,7 @@ import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
// tslint:disable-next-line:max-line-length | ||
var jsonObject = { hashId: this.pdfViewerBase.hashId, action: 'Bookmarks' }; | ||
var jsonObject = { hashId: this.pdfViewerBase.hashId, action: 'Bookmarks', elementId: this.pdfViewer.element.id }; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// tslint:disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
this.bookmarkRequestHandler = new AjaxHandler(this.pdfViewer); | ||
@@ -62,6 +66,14 @@ this.bookmarkRequestHandler.url = proxy.pdfViewer.serviceUrl + '/Bookmarks'; | ||
if (typeof data !== 'object') { | ||
data = JSON.parse(data); | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
catch (error) { | ||
proxy.pdfViewerBase.onControlError(500, data, 'Bookmarks'); | ||
data = null; | ||
} | ||
} | ||
proxy.bookmarks = { bookMark: data.Bookmarks }; | ||
proxy.bookmarksDestination = { bookMarkDestination: data.BookmarksDestination }; | ||
if (data) { | ||
proxy.bookmarks = { bookMark: data.Bookmarks }; | ||
proxy.bookmarksDestination = { bookMarkDestination: data.BookmarksDestination }; | ||
} | ||
} | ||
@@ -80,3 +92,3 @@ if (proxy.pdfViewerBase.navigationPane) { | ||
this.bookmarkRequestHandler.onFailure = function (result) { | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, 'Bookmarks'); | ||
}; | ||
@@ -86,3 +98,3 @@ // tslint:disable-next-line | ||
proxy.pdfViewerBase.openNotificationPopup(); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, 'Bookmarks'); | ||
}; | ||
@@ -133,2 +145,3 @@ }; | ||
}); | ||
this.treeObj.isStringTemplate = true; | ||
if (this.pdfViewer.enableRtl) { | ||
@@ -164,2 +177,3 @@ this.treeObj.enableRtl = true; | ||
}); | ||
this.bookmarkList.isStringTemplate = true; | ||
if (this.pdfViewer.enableRtl) { | ||
@@ -172,3 +186,3 @@ this.bookmarkList.enableRtl = true; | ||
BookmarkView.prototype.setHeight = function (element) { | ||
if (this.treeObj.fullRowSelect) { | ||
if (this.treeObj.fullRowSelect && element.classList) { | ||
if (element.classList.contains('e-treeview')) { | ||
@@ -180,4 +194,15 @@ element = element.querySelector('.e-node-focus').querySelector('.e-fullrow'); | ||
} | ||
else if (element.classList.value !== ('e-fullrow') && element.closest('.e-list-item')) { | ||
element = element.closest('.e-list-item').querySelector('.e-fullrow'); | ||
else if (element.classList.value !== ('e-fullrow')) { | ||
if (element.closest && element.closest('.e-list-item')) { | ||
element = element.closest('.e-list-item').querySelector('.e-fullrow'); | ||
} | ||
else { | ||
if (element.classList.contains('e-list-item')) { | ||
element = element.querySelector('.e-fullrow'); | ||
} | ||
else if (element.classList.contains('e-icons') && element.classList.contains('interaction') | ||
&& element.parentElement.parentElement.classList.contains('e-list-item')) { | ||
element = element.parentElement.parentElement.querySelector('.e-fullrow'); | ||
} | ||
} | ||
} | ||
@@ -228,5 +253,11 @@ if (element.nextElementSibling) { | ||
var proxy = this; | ||
var destPage = (this.pdfViewerBase.pageSize[pageIndex - 1].height); | ||
// tslint:disable-next-line:max-line-length | ||
var scrollValue = this.pdfViewerBase.pageSize[pageIndex].top * this.pdfViewerBase.getZoomFactor() + ((destPage - y) * this.pdfViewerBase.getZoomFactor()); | ||
var destPage = (this.pdfViewerBase.pageSize[pageIndex].height); | ||
var scrollValue; | ||
if (y === 0) { | ||
scrollValue = this.pdfViewerBase.pageSize[pageIndex].top * this.pdfViewerBase.getZoomFactor(); | ||
} | ||
else { | ||
// tslint:disable-next-line:max-line-length | ||
scrollValue = this.pdfViewerBase.pageSize[pageIndex].top * this.pdfViewerBase.getZoomFactor() + ((destPage - y) * this.pdfViewerBase.getZoomFactor()); | ||
} | ||
var scroll = scrollValue.toString(); | ||
@@ -233,0 +264,0 @@ // tslint:disable-next-line:radix |
@@ -157,12 +157,14 @@ import { Browser } from '@syncfusion/ej2-base'; | ||
var zoomValue = this.calculateFitZoomFactor('fitToPage'); | ||
this.isAutoZoom = false; | ||
this.onZoomChanged(zoomValue); | ||
if (Browser.isDevice) { | ||
this.pdfViewerBase.viewerContainer.style.overflowY = 'hidden'; | ||
if (zoomValue !== null) { | ||
this.isAutoZoom = false; | ||
this.onZoomChanged(zoomValue); | ||
if (Browser.isDevice) { | ||
this.pdfViewerBase.viewerContainer.style.overflowY = 'hidden'; | ||
} | ||
else { | ||
this.pdfViewerBase.viewerContainer.style.overflowY = 'auto'; | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewerBase.viewerContainer.scrollTop = this.pdfViewerBase.pageSize[this.pdfViewerBase.currentPageNumber - 1].top * this.zoomFactor; | ||
} | ||
else { | ||
this.pdfViewerBase.viewerContainer.style.overflowY = 'auto'; | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
this.pdfViewerBase.viewerContainer.scrollTop = this.pdfViewerBase.pageSize[this.pdfViewerBase.currentPageNumber - 1].top * this.zoomFactor; | ||
}; | ||
@@ -175,2 +177,9 @@ /** | ||
var viewerHeight = this.pdfViewerBase.viewerContainer.getBoundingClientRect().height; | ||
if (viewerWidth === 0 && viewerHeight === 0) { | ||
viewerWidth = parseFloat(this.pdfViewer.width.toString()); | ||
viewerHeight = parseFloat(this.pdfViewer.height.toString()); | ||
} | ||
if (isNaN(viewerHeight) || isNaN(viewerWidth)) { | ||
return null; | ||
} | ||
var highestWidth = 0; | ||
@@ -336,3 +345,5 @@ var highestHeight = 0; | ||
} | ||
this.isMagnified = true; | ||
if (!this.isInitialLoading) { | ||
this.isMagnified = true; | ||
} | ||
this.updatePageLocation(); | ||
@@ -373,3 +384,3 @@ this.resizeCanvas(this.reRenderPageNumber); | ||
this.clearRendering(); | ||
var oldCanvases = document.querySelectorAll('canvas[id*="oldCanvas"]'); | ||
var oldCanvases = document.querySelectorAll('canvas[id*="' + this.pdfViewer.element.id + '_oldCanvas_"]'); | ||
for (var i = 0; i < oldCanvases.length; i++) { | ||
@@ -409,3 +420,3 @@ // tslint:disable-next-line | ||
Magnification.prototype.rerenderMagnifiedPages = function () { | ||
if (this.pdfViewerBase.isInitialLoaded) { | ||
if (this.pdfViewerBase.isInitialLoaded || this.pdfViewerBase.isDocumentLoaded) { | ||
this.renderInSeparateThread(this.reRenderPageNumber); | ||
@@ -433,2 +444,5 @@ this.isPagesZoomed = false; | ||
} | ||
if (this.pdfViewer.textSearchModule) { | ||
this.pdfViewer.textSearchModule.clearAllOccurrences(); | ||
} | ||
var scrollValue = this.pdfViewerBase.viewerContainer.scrollTop; | ||
@@ -476,3 +490,3 @@ this.isAutoZoom = false; | ||
if (this.pdfViewerBase.textLayer) { | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -483,3 +497,4 @@ textLayers[i].style.display = 'block'; | ||
if (this.pdfViewerBase.isTextMarkupAnnotationModule()) { | ||
var annotationLayers = document.querySelectorAll('canvas[id*="_annotationCanvas_"]'); | ||
// tslint:disable-next-line:max-line-length | ||
var annotationLayers = document.querySelectorAll('canvas[id*="' + this.pdfViewer.element.id + '_annotationCanvas_"]'); | ||
for (var j = 0; j < annotationLayers.length; j++) { | ||
@@ -801,3 +816,5 @@ var pageNumber = annotationLayers[j].id.split('_annotationCanvas_')[1]; | ||
Magnification.prototype.onDoubleTapMagnification = function () { | ||
this.pdfViewer.toolbarModule.showToolbar(false); | ||
if (this.pdfViewer.toolbarModule) { | ||
this.pdfViewer.toolbarModule.showToolbar(false); | ||
} | ||
var scrollValue = this.pdfViewerBase.viewerContainer.scrollTop; | ||
@@ -804,0 +821,0 @@ if (!this.isTapToFitZoom) { |
@@ -1,2 +0,2 @@ | ||
import { Component, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, L10n, Collection, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration, isNullOrUndefined, Property, Event, EmitType } from '@syncfusion/ej2-base';import { PdfViewerBase } from './index';import { Navigation } from './index';import { Magnification } from './index';import { Toolbar } from './index';import { ToolbarItem } from './index';import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle } from './base/types';import { Annotation } from './index';import { LinkAnnotation } from './index';import { ThumbnailView } from './index';import { BookmarkView } from './index';import { TextSelection } from './index';import { TextSearch } from './index';import { Print } from './index';import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs } from './index';import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs } from './index';import { PdfAnnotationBase, ZOrderPageTable } from '../diagram/pdf-annotation';import { PdfAnnotationBaseModel } from '../diagram/pdf-annotation-model';import { Drawing, ClipBoardObject } from '../diagram/drawing';import { Selector } from '../diagram/selector';import { SelectorModel } from '../diagram/selector-model';import { PointModel, IElement, Rect } from '@syncfusion/ej2-drawings';import { renderAdornerLayer } from '../diagram/dom-util'; | ||
import { Component, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, L10n, Collection, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration, isNullOrUndefined, Property, Event, EmitType } from '@syncfusion/ej2-base';import { PdfViewerBase } from './index';import { Navigation } from './index';import { Magnification } from './index';import { Toolbar } from './index';import { ToolbarItem } from './index';import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle, ContextMenuAction } from './base/types';import { Annotation } from './index';import { LinkAnnotation } from './index';import { ThumbnailView } from './index';import { BookmarkView } from './index';import { TextSelection } from './index';import { TextSearch } from './index';import { Print, CalibrationUnit } from './index';import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs, HyperlinkMouseOverArgs } from './index';import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs, AnnotationSelectEventArgs } from './index';import { PdfAnnotationBase, ZOrderPageTable } from '../diagram/pdf-annotation';import { PdfAnnotationBaseModel } from '../diagram/pdf-annotation-model';import { Drawing, ClipBoardObject } from '../diagram/drawing';import { Selector } from '../diagram/selector';import { SelectorModel } from '../diagram/selector-model';import { PointModel, IElement, Rect } from '@syncfusion/ej2-drawings';import { renderAdornerLayer } from '../diagram/dom-util'; | ||
import {IAjaxHeaders} from "./pdfviewer"; | ||
@@ -18,3 +18,3 @@ import {ComponentModel} from '@syncfusion/ej2-base'; | ||
*/ | ||
toolbarItem?: ToolbarItem[]; | ||
toolbarItems?: ToolbarItem[]; | ||
@@ -36,2 +36,19 @@ } | ||
/** | ||
* Interface for a class CustomStampItem | ||
*/ | ||
export interface CustomStampItemModel { | ||
/** | ||
* specifies the stamp Name of the PdfViewer. | ||
*/ | ||
customStampName?: string; | ||
/** | ||
* specifies the stamp ImageSource of the PdfViewer. | ||
*/ | ||
customStampImageSource?: string; | ||
} | ||
/** | ||
* Interface for a class AnnotationToolbarSettings | ||
@@ -93,2 +110,12 @@ */ | ||
/** | ||
* specifies the imports annotations action of PdfViewer. | ||
*/ | ||
importAnnotations?: string; | ||
/** | ||
* specifies the export annotations action of PdfViewer. | ||
*/ | ||
exportAnnotations?: string; | ||
} | ||
@@ -494,2 +521,7 @@ | ||
/** | ||
* Specifies to maintain the newly added custom stamp element in the menu items. | ||
*/ | ||
isAddToSubMenu?: boolean; | ||
} | ||
@@ -765,2 +797,29 @@ | ||
/** | ||
* Interface for a class MeasurementSettings | ||
*/ | ||
export interface MeasurementSettingsModel { | ||
/** | ||
* specifies the scale ratio of the annotation. | ||
*/ | ||
scaleRatio?: number; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
conversionUnit?: CalibrationUnit; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
displayUnit?: CalibrationUnit; | ||
/** | ||
* specifies the depth of the volume annotation. | ||
*/ | ||
depth?: number; | ||
} | ||
/** | ||
* Interface for a class PdfViewer | ||
@@ -841,2 +900,8 @@ */ | ||
/** | ||
* Specifies the state of the ContextMenu in the PDF document. | ||
* @default RightClick | ||
*/ | ||
contextMenuOption?: ContextMenuAction; | ||
/** | ||
* Enable or disables the Navigation module of PdfViewer. | ||
@@ -908,2 +973,8 @@ * @default true | ||
/** | ||
* Opens the annotation toolbar when the PDF document is loaded in the PDF Viewer control initially. | ||
* @default false | ||
*/ | ||
enableAnnotationToolbar?: boolean; | ||
/** | ||
* Sets the interaction mode of the PdfViewer | ||
@@ -927,2 +998,9 @@ * @default TextSelection | ||
/** | ||
* Defines the stamp items of the PdfViewer. | ||
*/ | ||
// tslint:disable-next-line:max-line-length | ||
customStampItems?: CustomStampItemModel[]; | ||
/** | ||
* Defines the settings of the PdfViewer annotation toolbar. | ||
@@ -1032,2 +1110,7 @@ */ | ||
/** | ||
* Defines the settings of measurement annotation. | ||
*/ | ||
measurementSettings?: MeasurementSettingsModel; | ||
/** | ||
* Defines the collection of selected items, size and position of the selector | ||
@@ -1088,2 +1171,9 @@ * @default {} | ||
/** | ||
* Triggers when hyperlink in the PDF Document is hovered | ||
* @event | ||
* @blazorProperty 'OnHyperlinkMouseOver' | ||
*/ | ||
hyperlinkMouseOver?: EmitType<HyperlinkMouseOverArgs>; | ||
/** | ||
* Triggers when there is change in the magnification value. | ||
@@ -1124,2 +1214,9 @@ * @event | ||
/** | ||
* Triggers when an annotation is selected over the page of the PDF document. | ||
* @event | ||
* @blazorProperty 'AnnotationSelected' | ||
*/ | ||
annotationSelect?: EmitType<AnnotationSelectEventArgs>; | ||
/** | ||
* Triggers when the property of the annotation is changed in the page of the PDF document. | ||
@@ -1126,0 +1223,0 @@ * @event |
import { Component, INotifyPropertyChanged, ChildProperty, L10n } from '@syncfusion/ej2-base'; | ||
import { ModuleDeclaration, EmitType } from '@syncfusion/ej2-base'; | ||
import { PdfViewerModel, HighlightSettingsModel, UnderlineSettingsModel, StrikethroughSettingsModel, LineSettingsModel, ArrowSettingsModel, RectangleSettingsModel, CircleSettingsModel, PolygonSettingsModel, StampSettingsModel, StickyNotesSettingsModel, CustomStampSettingsModel, VolumeSettingsModel, RadiusSettingsModel, AreaSettingsModel, PerimeterSettingsModel, DistanceSettingsModel } from './pdfviewer-model'; | ||
import { PdfViewerModel, HighlightSettingsModel, UnderlineSettingsModel, StrikethroughSettingsModel, LineSettingsModel, ArrowSettingsModel, RectangleSettingsModel, CircleSettingsModel, PolygonSettingsModel, StampSettingsModel, StickyNotesSettingsModel, CustomStampSettingsModel, VolumeSettingsModel, RadiusSettingsModel, AreaSettingsModel, PerimeterSettingsModel, DistanceSettingsModel, MeasurementSettingsModel } from './pdfviewer-model'; | ||
import { ToolbarSettingsModel, AnnotationToolbarSettingsModel } from './pdfviewer-model'; | ||
import { ServerActionSettingsModel, AjaxRequestSettingsModel } from './pdfviewer-model'; | ||
import { ServerActionSettingsModel, AjaxRequestSettingsModel, CustomStampItemModel } from './pdfviewer-model'; | ||
import { PdfViewerBase } from './index'; | ||
@@ -11,3 +11,3 @@ import { Navigation } from './index'; | ||
import { ToolbarItem } from './index'; | ||
import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle } from './base/types'; | ||
import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle, ContextMenuAction } from './base/types'; | ||
import { Annotation } from './index'; | ||
@@ -19,5 +19,5 @@ import { LinkAnnotation } from './index'; | ||
import { TextSearch } from './index'; | ||
import { Print } from './index'; | ||
import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs } from './index'; | ||
import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs } from './index'; | ||
import { Print, CalibrationUnit } from './index'; | ||
import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs, HyperlinkMouseOverArgs } from './index'; | ||
import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs, AnnotationSelectEventArgs } from './index'; | ||
import { PdfAnnotationBase, ZOrderPageTable } from '../diagram/pdf-annotation'; | ||
@@ -39,3 +39,3 @@ import { PdfAnnotationBaseModel } from '../diagram/pdf-annotation-model'; | ||
*/ | ||
toolbarItem: ToolbarItem[]; | ||
toolbarItems: ToolbarItem[]; | ||
} | ||
@@ -61,2 +61,12 @@ /** | ||
} | ||
export declare class CustomStampItem extends ChildProperty<CustomStampItem> { | ||
/** | ||
* specifies the stamp Name of the PdfViewer. | ||
*/ | ||
customStampName: string; | ||
/** | ||
* specifies the stamp ImageSource of the PdfViewer. | ||
*/ | ||
customStampImageSource: string; | ||
} | ||
/** | ||
@@ -107,2 +117,10 @@ * The `AnnotationToolbarSettings` module is used to provide the annotation toolbar settings of the PDF viewer. | ||
renderComments: string; | ||
/** | ||
* specifies the imports annotations action of PdfViewer. | ||
*/ | ||
importAnnotations: string; | ||
/** | ||
* specifies the export annotations action of PdfViewer. | ||
*/ | ||
exportAnnotations: string; | ||
} | ||
@@ -422,2 +440,6 @@ /** | ||
top: number; | ||
/** | ||
* Specifies to maintain the newly added custom stamp element in the menu items. | ||
*/ | ||
isAddToSubMenu: boolean; | ||
} | ||
@@ -635,2 +657,23 @@ /** | ||
/** | ||
* The `MeasurementSettings` module is used to provide the settings to measurement annotations. | ||
*/ | ||
export declare class MeasurementSettings extends ChildProperty<MeasurementSettings> { | ||
/** | ||
* specifies the scale ratio of the annotation. | ||
*/ | ||
scaleRatio: number; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
conversionUnit: CalibrationUnit; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
displayUnit: CalibrationUnit; | ||
/** | ||
* specifies the depth of the volume annotation. | ||
*/ | ||
depth: number; | ||
} | ||
/** | ||
* Represents the PDF viewer component. | ||
@@ -653,2 +696,3 @@ * ```html | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -659,2 +703,3 @@ readonly pageCount: number; | ||
* @asptype bool | ||
* @blazorType bool | ||
*/ | ||
@@ -665,2 +710,3 @@ readonly isDocumentEdited: boolean; | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -675,2 +721,3 @@ readonly currentPageNumber: number; | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -733,2 +780,7 @@ readonly zoomPercentage: number; | ||
/** | ||
* Specifies the state of the ContextMenu in the PDF document. | ||
* @default RightClick | ||
*/ | ||
contextMenuOption: ContextMenuAction; | ||
/** | ||
* Enable or disables the Navigation module of PdfViewer. | ||
@@ -789,2 +841,7 @@ * @default true | ||
/** | ||
* Opens the annotation toolbar when the PDF document is loaded in the PDF Viewer control initially. | ||
* @default false | ||
*/ | ||
enableAnnotationToolbar: boolean; | ||
/** | ||
* Sets the interaction mode of the PdfViewer | ||
@@ -803,2 +860,6 @@ * @default TextSelection | ||
/** | ||
* Defines the stamp items of the PdfViewer. | ||
*/ | ||
customStampItems: CustomStampItemModel[]; | ||
/** | ||
* Defines the settings of the PdfViewer annotation toolbar. | ||
@@ -876,2 +937,6 @@ */ | ||
/** | ||
* Defines the settings of measurement annotation. | ||
*/ | ||
measurementSettings: MeasurementSettingsModel; | ||
/** | ||
* @private | ||
@@ -955,2 +1020,3 @@ */ | ||
* @asptype BookmarkView | ||
* @blazorType BookmarkView | ||
* @returns { BookmarkView } | ||
@@ -962,2 +1028,3 @@ */ | ||
* @asptype Print | ||
* @blazorType Print | ||
* @returns { Print } | ||
@@ -969,2 +1036,3 @@ */ | ||
* @asptype Magnification | ||
* @blazorType Magnification | ||
* @returns { Magnification } | ||
@@ -976,2 +1044,3 @@ */ | ||
* @asptype Navigation | ||
* @blazorType Navigation | ||
* @returns { Navigation } | ||
@@ -983,2 +1052,3 @@ */ | ||
* @asptype TextSearch | ||
* @blazorType TextSearch | ||
* @returns { TextSearch } | ||
@@ -990,2 +1060,3 @@ */ | ||
* @asptype Toolbar | ||
* @blazorType Toolbar | ||
* @returns { Toolbar } | ||
@@ -997,2 +1068,3 @@ */ | ||
* @asptype ThumbnailView | ||
* @blazorType ThumbnailView | ||
* @returns { ThumbnailView } | ||
@@ -1004,2 +1076,3 @@ */ | ||
* @asptype Annotation | ||
* @blazorType Annotation | ||
* @returns { Annotation } | ||
@@ -1051,2 +1124,8 @@ */ | ||
/** | ||
* Triggers when hyperlink in the PDF Document is hovered | ||
* @event | ||
* @blazorProperty 'OnHyperlinkMouseOver' | ||
*/ | ||
hyperlinkMouseOver: EmitType<HyperlinkMouseOverArgs>; | ||
/** | ||
* Triggers when there is change in the magnification value. | ||
@@ -1082,2 +1161,8 @@ * @event | ||
/** | ||
* Triggers when an annotation is selected over the page of the PDF document. | ||
* @event | ||
* @blazorProperty 'AnnotationSelected' | ||
*/ | ||
annotationSelect: EmitType<AnnotationSelectEventArgs>; | ||
/** | ||
* Triggers when the property of the annotation is changed in the page of the PDF document. | ||
@@ -1131,2 +1216,12 @@ * @event | ||
/** | ||
* Saves the PDF document being loaded in the PDF Viewer control as blob. | ||
* @returns Promise<Blob> | ||
*/ | ||
saveAsBlob(): Promise<Blob>; | ||
/** | ||
* updates the PDF Viewer container width and height from externally. | ||
* @returns void | ||
*/ | ||
updateViewerContainer(): void; | ||
/** | ||
* Perform undo action for the edited annotations | ||
@@ -1151,2 +1246,13 @@ * @returns void | ||
/** | ||
* Perform imports annotations action in the PDF Viewer | ||
* @param {any} importData - Specifies the data for annotation imports | ||
* @returns void | ||
*/ | ||
importAnnotations(importData: any): void; | ||
/** | ||
* Perform export annotations action in the PDF Viewer | ||
* @returns void | ||
*/ | ||
exportAnnotations(): void; | ||
/** | ||
* @private | ||
@@ -1166,3 +1272,3 @@ */ | ||
*/ | ||
fireAjaxRequestFailed(errorStatusCode: number, errorMessage: string): void; | ||
fireAjaxRequestFailed(errorStatusCode: number, errorMessage: string, action: string): void; | ||
/** | ||
@@ -1183,6 +1289,10 @@ * @private | ||
*/ | ||
fireHyperlinkClick(hyperlink: string): void; | ||
fireHyperlinkClick(hyperlink: string, hyperlinkElement: HTMLAnchorElement): void; | ||
/** | ||
* @private | ||
*/ | ||
fireHyperlinkHover(hyperlinkElement: HTMLAnchorElement): void; | ||
/** | ||
* @private | ||
*/ | ||
fireAnnotationAdd(pageNumber: number, index: number, type: AnnotationType, bounds: any, settings: any): void; | ||
@@ -1200,2 +1310,6 @@ /** | ||
*/ | ||
fireAnnotationSelect(id: string, pageNumber: number, annotation: any): void; | ||
/** | ||
* @private | ||
*/ | ||
renderDrawing(canvas?: HTMLCanvasElement, index?: number): void; | ||
@@ -1202,0 +1316,0 @@ /** |
@@ -40,3 +40,3 @@ var __extends = (this && this.__extends) || (function () { | ||
Property() | ||
], ToolbarSettings.prototype, "toolbarItem", void 0); | ||
], ToolbarSettings.prototype, "toolbarItems", void 0); | ||
return ToolbarSettings; | ||
@@ -59,2 +59,16 @@ }(ChildProperty)); | ||
export { AjaxRequestSettings }; | ||
var CustomStampItem = /** @class */ (function (_super) { | ||
__extends(CustomStampItem, _super); | ||
function CustomStampItem() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
__decorate([ | ||
Property('') | ||
], CustomStampItem.prototype, "customStampName", void 0); | ||
__decorate([ | ||
Property('') | ||
], CustomStampItem.prototype, "customStampImageSource", void 0); | ||
return CustomStampItem; | ||
}(ChildProperty)); | ||
export { CustomStampItem }; | ||
/** | ||
@@ -106,2 +120,8 @@ * The `AnnotationToolbarSettings` module is used to provide the annotation toolbar settings of the PDF viewer. | ||
], ServerActionSettings.prototype, "renderComments", void 0); | ||
__decorate([ | ||
Property('ImportAnnotations') | ||
], ServerActionSettings.prototype, "importAnnotations", void 0); | ||
__decorate([ | ||
Property('ExportAnnotations') | ||
], ServerActionSettings.prototype, "exportAnnotations", void 0); | ||
return ServerActionSettings; | ||
@@ -415,2 +435,5 @@ }(ChildProperty)); | ||
], CustomStampSettings.prototype, "top", void 0); | ||
__decorate([ | ||
Property(false) | ||
], CustomStampSettings.prototype, "isAddToSubMenu", void 0); | ||
return CustomStampSettings; | ||
@@ -621,2 +644,25 @@ }(ChildProperty)); | ||
/** | ||
* The `MeasurementSettings` module is used to provide the settings to measurement annotations. | ||
*/ | ||
var MeasurementSettings = /** @class */ (function (_super) { | ||
__extends(MeasurementSettings, _super); | ||
function MeasurementSettings() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
__decorate([ | ||
Property(1) | ||
], MeasurementSettings.prototype, "scaleRatio", void 0); | ||
__decorate([ | ||
Property('in') | ||
], MeasurementSettings.prototype, "conversionUnit", void 0); | ||
__decorate([ | ||
Property('in') | ||
], MeasurementSettings.prototype, "displayUnit", void 0); | ||
__decorate([ | ||
Property(96) | ||
], MeasurementSettings.prototype, "depth", void 0); | ||
return MeasurementSettings; | ||
}(ChildProperty)); | ||
export { MeasurementSettings }; | ||
/** | ||
* Represents the PDF viewer component. | ||
@@ -759,3 +805,17 @@ * ```html | ||
'Calibrate Volume': 'Calibrate Volume', | ||
'Depth': 'Depth' | ||
'Depth': 'Depth', | ||
'Closed': 'Closed', | ||
'Round': 'Round', | ||
'Square': 'Square', | ||
'Diamond': 'Diamond', | ||
'Edit': 'Edit', | ||
'Comment': 'Comment', | ||
'Comment Panel': 'Comment Panel', | ||
'Set Status': 'Set Status', | ||
'Post': 'Post', | ||
'Page': 'Page', | ||
'Add a comment': 'Add a comment', | ||
'Add a reply': 'Add a reply', | ||
'Import Annotations': 'Import Annotations', | ||
'Export Annotations': 'Export Annotations' | ||
}; | ||
@@ -770,2 +830,3 @@ _this.viewerBase = new PdfViewerBase(_this); | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -782,2 +843,3 @@ get: function () { | ||
* @asptype bool | ||
* @blazorType bool | ||
*/ | ||
@@ -794,2 +856,3 @@ get: function () { | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -806,2 +869,3 @@ get: function () { | ||
* @asptype int | ||
* @blazorType int | ||
*/ | ||
@@ -818,2 +882,3 @@ get: function () { | ||
* @asptype BookmarkView | ||
* @blazorType BookmarkView | ||
* @returns { BookmarkView } | ||
@@ -831,2 +896,3 @@ */ | ||
* @asptype Print | ||
* @blazorType Print | ||
* @returns { Print } | ||
@@ -844,2 +910,3 @@ */ | ||
* @asptype Magnification | ||
* @blazorType Magnification | ||
* @returns { Magnification } | ||
@@ -857,2 +924,3 @@ */ | ||
* @asptype Navigation | ||
* @blazorType Navigation | ||
* @returns { Navigation } | ||
@@ -870,2 +938,3 @@ */ | ||
* @asptype TextSearch | ||
* @blazorType TextSearch | ||
* @returns { TextSearch } | ||
@@ -883,2 +952,3 @@ */ | ||
* @asptype Toolbar | ||
* @blazorType Toolbar | ||
* @returns { Toolbar } | ||
@@ -896,2 +966,3 @@ */ | ||
* @asptype ThumbnailView | ||
* @blazorType ThumbnailView | ||
* @returns { ThumbnailView } | ||
@@ -909,2 +980,3 @@ */ | ||
* @asptype Annotation | ||
* @blazorType Annotation | ||
* @returns { Annotation } | ||
@@ -953,2 +1025,44 @@ */ | ||
break; | ||
case 'documentPath': | ||
this.load(newProp.documentPath, null); | ||
break; | ||
case 'interactionMode': | ||
this.interactionMode = newProp.interactionMode; | ||
if (newProp.interactionMode === 'Pan') { | ||
this.viewerBase.initiatePanning(); | ||
if (this.toolbar) { | ||
this.toolbar.updateInteractionTools(false); | ||
} | ||
} | ||
else if (newProp.interactionMode === 'TextSelection') { | ||
this.viewerBase.initiateTextSelectMode(); | ||
if (this.toolbar) { | ||
this.toolbar.updateInteractionTools(true); | ||
} | ||
} | ||
break; | ||
case 'height': | ||
this.height = newProp.height; | ||
this.viewerBase.updateHeight(); | ||
this.viewerBase.onWindowResize(); | ||
if (this.toolbar.annotationToolbarModule.isToolbarHidden) { | ||
this.toolbar.annotationToolbarModule.adjustViewer(false); | ||
} | ||
else { | ||
this.toolbar.annotationToolbarModule.adjustViewer(true); | ||
} | ||
break; | ||
case 'width': | ||
this.width = newProp.width; | ||
this.viewerBase.updateWidth(); | ||
this.viewerBase.onWindowResize(); | ||
break; | ||
case 'customStampItems': | ||
this.annotation.stampAnnotationModule.isStampAddMode = true; | ||
this.annotationModule.stampAnnotationModule.isStampAnnotSelected = true; | ||
this.viewerBase.stampAdded = true; | ||
this.viewerBase.isAlreadyAdded = false; | ||
// tslint:disable-next-line:max-line-length | ||
this.annotation.stampAnnotationModule.createCustomStampAnnotation(this.customStampItems[0].customStampImageSource); | ||
break; | ||
} | ||
@@ -1044,2 +1158,24 @@ } | ||
/** | ||
* Saves the PDF document being loaded in the PDF Viewer control as blob. | ||
* @returns Promise<Blob> | ||
*/ | ||
PdfViewer.prototype.saveAsBlob = function () { | ||
var _this = this; | ||
if (this.enableDownload) { | ||
return new Promise(function (resolve, reject) { | ||
resolve(_this.viewerBase.saveAsBlob()); | ||
}); | ||
} | ||
else { | ||
return null; | ||
} | ||
}; | ||
/** | ||
* updates the PDF Viewer container width and height from externally. | ||
* @returns void | ||
*/ | ||
PdfViewer.prototype.updateViewerContainer = function () { | ||
this.viewerBase.updateViewerContainer(); | ||
}; | ||
/** | ||
* Perform undo action for the edited annotations | ||
@@ -1086,3 +1222,24 @@ * @returns void | ||
}; | ||
// tslint:disable-next-line | ||
/** | ||
* Perform imports annotations action in the PDF Viewer | ||
* @param {any} importData - Specifies the data for annotation imports | ||
* @returns void | ||
*/ | ||
// tslint:disable-next-line | ||
PdfViewer.prototype.importAnnotations = function (importData) { | ||
if (this.annotationModule) { | ||
this.viewerBase.importAnnotations(importData); | ||
} | ||
}; | ||
/** | ||
* Perform export annotations action in the PDF Viewer | ||
* @returns void | ||
*/ | ||
PdfViewer.prototype.exportAnnotations = function () { | ||
if (this.annotationModule) { | ||
this.viewerBase.exportAnnotations(); | ||
} | ||
}; | ||
/** | ||
* @private | ||
@@ -1112,5 +1269,5 @@ */ | ||
*/ | ||
PdfViewer.prototype.fireAjaxRequestFailed = function (errorStatusCode, errorMessage) { | ||
PdfViewer.prototype.fireAjaxRequestFailed = function (errorStatusCode, errorMessage, action) { | ||
// tslint:disable-next-line:max-line-length | ||
var eventArgs = { name: 'ajaxRequestFailed', documentName: this.fileName, errorStatusCode: errorStatusCode, errorMessage: errorMessage }; | ||
var eventArgs = { name: 'ajaxRequestFailed', documentName: this.fileName, errorStatusCode: errorStatusCode, errorMessage: errorMessage, action: action }; | ||
this.trigger('ajaxRequestFailed', eventArgs); | ||
@@ -1144,5 +1301,5 @@ }; | ||
*/ | ||
PdfViewer.prototype.fireHyperlinkClick = function (hyperlink) { | ||
PdfViewer.prototype.fireHyperlinkClick = function (hyperlink, hyperlinkElement) { | ||
// tslint:disable-next-line:max-line-length | ||
var eventArgs = { name: 'hyperlinkClick', hyperlink: hyperlink }; | ||
var eventArgs = { name: 'hyperlinkClick', hyperlink: hyperlink, hyperlinkElement: hyperlinkElement }; | ||
this.trigger('hyperlinkClick', eventArgs); | ||
@@ -1153,2 +1310,10 @@ }; | ||
*/ | ||
PdfViewer.prototype.fireHyperlinkHover = function (hyperlinkElement) { | ||
// tslint:disable-next-line:max-line-length | ||
var eventArgs = { name: 'hyperlinkMouseOver', hyperlinkElement: hyperlinkElement }; | ||
this.trigger('hyperlinkMouseOver', eventArgs); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
// tslint:disable-next-line | ||
@@ -1178,2 +1343,10 @@ PdfViewer.prototype.fireAnnotationAdd = function (pageNumber, index, type, bounds, settings) { | ||
*/ | ||
// tslint:disable-next-line | ||
PdfViewer.prototype.fireAnnotationSelect = function (id, pageNumber, annotation) { | ||
var eventArgs = { name: 'annotationSelect', annotationId: id, pageIndex: pageNumber, annotation: annotation }; | ||
this.trigger('annotationSelect', eventArgs); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PdfViewer.prototype.renderDrawing = function (canvas, index) { | ||
@@ -1183,3 +1356,5 @@ if (!index && this.viewerBase.activeElements.activePageID) { | ||
} | ||
this.annotation.renderAnnotations(index, null, null, null, canvas); | ||
if (this.annotation) { | ||
this.annotation.renderAnnotations(index, null, null, null, canvas); | ||
} | ||
}; | ||
@@ -1210,2 +1385,6 @@ /** | ||
PdfViewer.prototype.select = function (objArray, multipleSelection, preventUpdate) { | ||
var annotationSelect = this.annotationModule.textMarkupAnnotationModule.selectTextMarkupCurrentPage; | ||
if (annotationSelect) { | ||
this.annotationModule.textMarkupAnnotationModule.clearCurrentAnnotationSelection(annotationSelect, true); | ||
} | ||
this.drawing.select(objArray, multipleSelection, preventUpdate); | ||
@@ -1370,2 +1549,5 @@ }; | ||
__decorate([ | ||
Property('RightClick') | ||
], PdfViewer.prototype, "contextMenuOption", void 0); | ||
__decorate([ | ||
Property(true) | ||
@@ -1404,6 +1586,9 @@ ], PdfViewer.prototype, "enableNavigation", void 0); | ||
__decorate([ | ||
Property(false) | ||
], PdfViewer.prototype, "enableAnnotationToolbar", void 0); | ||
__decorate([ | ||
Property('TextSelection') | ||
], PdfViewer.prototype, "interactionMode", void 0); | ||
__decorate([ | ||
Property({ showTooltip: true, toolbarItem: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] }) | ||
Property({ showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] }) | ||
], PdfViewer.prototype, "toolbarSettings", void 0); | ||
@@ -1414,6 +1599,9 @@ __decorate([ | ||
__decorate([ | ||
Property({ customStampName: '', customStampImageSource: '' }) | ||
], PdfViewer.prototype, "customStampItems", void 0); | ||
__decorate([ | ||
Property({ showTooltip: true, annotationToolbarItem: ['HighlightTool', 'UnderlineTool', 'StrikethroughTool', 'ColorEditTool', 'OpacityEditTool', 'AnnotationDeleteTool', 'StampAnnotationTool', 'ShapeTool', 'CalibrateTool', 'StrokeColorEditTool', 'ThicknessEditTool'] }) | ||
], PdfViewer.prototype, "annotationToolbarSettings", void 0); | ||
__decorate([ | ||
Property({ load: 'Load', renderPages: 'RenderPdfPages', unload: 'Unload', download: 'Download', renderThumbnail: 'RenderThumbnailImages', print: 'PrintImages', renderComments: 'RenderAnnotationComments' }) | ||
Property({ load: 'Load', renderPages: 'RenderPdfPages', unload: 'Unload', download: 'Download', renderThumbnail: 'RenderThumbnailImages', print: 'PrintImages', renderComments: 'RenderAnnotationComments', importAnnotations: 'ImportAnnotations', exportAnnotations: 'ExportAnnotations' }) | ||
], PdfViewer.prototype, "serverActionSettings", void 0); | ||
@@ -1469,2 +1657,5 @@ __decorate([ | ||
__decorate([ | ||
Property({ conversionUnit: 'in', displayUnit: 'in', scaleRatio: 1, depth: 96 }) | ||
], PdfViewer.prototype, "measurementSettings", void 0); | ||
__decorate([ | ||
Complex({}, Selector) | ||
@@ -1495,2 +1686,5 @@ ], PdfViewer.prototype, "selectedItems", void 0); | ||
Event() | ||
], PdfViewer.prototype, "hyperlinkMouseOver", void 0); | ||
__decorate([ | ||
Event() | ||
], PdfViewer.prototype, "zoomChange", void 0); | ||
@@ -1510,2 +1704,5 @@ __decorate([ | ||
__decorate([ | ||
Event() | ||
], PdfViewer.prototype, "annotationSelect", void 0); | ||
__decorate([ | ||
Collection([], PdfAnnotationBase) | ||
@@ -1512,0 +1709,0 @@ ], PdfViewer.prototype, "annotations", void 0); |
@@ -52,4 +52,9 @@ import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
hashId: this.pdfViewerBase.hashId, zoomFactor: 1, | ||
action: 'PrintImages' | ||
action: 'PrintImages', | ||
elementId: this.pdfViewer.element.id | ||
}; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// tslint:disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
proxy.printRequestHandler = new AjaxHandler(proxy.pdfViewer); | ||
@@ -65,53 +70,97 @@ proxy.printRequestHandler.url = proxy.pdfViewer.serviceUrl + '/' + proxy.pdfViewer.serverActionSettings.print; | ||
if (typeof printImage !== 'object') { | ||
printImage = JSON.parse(printImage); | ||
try { | ||
printImage = JSON.parse(printImage); | ||
if (typeof printImage !== 'object') { | ||
proxy.pdfViewerBase.onControlError(500, printImage, proxy.pdfViewer.serverActionSettings.print); | ||
printImage = null; | ||
} | ||
} | ||
catch (error) { | ||
proxy.pdfViewerBase.onControlError(500, printImage, proxy.pdfViewer.serverActionSettings.print); | ||
printImage = null; | ||
} | ||
} | ||
var annotationSource = ''; | ||
if (printImage.textMarkupAnnotation && proxy.pdfViewerBase.isTextMarkupAnnotationModule()) { | ||
// tslint:disable-next-line | ||
var stampData = printImage['stampAnnotations']; | ||
// tslint:disable-next-line:max-line-length | ||
annotationSource = proxy.pdfViewer.annotationModule.textMarkupAnnotationModule.printTextMarkupAnnotations(printImage.textMarkupAnnotation, pageIndex, stampData, printImage.shapeAnnotation); | ||
} | ||
var currentPageNumber = printImage.pageNumber; | ||
// tslint:disable-next-line:max-line-length | ||
proxy.printCanvas = createElement('canvas', { id: proxy.pdfViewer.element.id + '_printCanvas_' + pageIndex, className: 'e-pv-print-canvas' }); | ||
proxy.printCanvas.style.width = pageWidth + 'px'; | ||
proxy.printCanvas.style.height = pageHeight + 'px'; | ||
proxy.printCanvas.height = 1056 * window.devicePixelRatio; | ||
proxy.printCanvas.width = 816 * window.devicePixelRatio; | ||
var context = proxy.printCanvas.getContext('2d'); | ||
var pageImage = new Image(); | ||
var annotationImage = new Image(); | ||
pageImage.onload = function () { | ||
if (pageHeight > pageWidth) { | ||
context.drawImage(pageImage, 0, 0, proxy.printCanvas.width, proxy.printCanvas.height); | ||
if (annotationSource) { | ||
context.drawImage(annotationImage, 0, 0, proxy.printCanvas.width, proxy.printCanvas.height); | ||
if (printImage) { | ||
var annotationSource_1 = ''; | ||
if (printImage.textMarkupAnnotation && proxy.pdfViewerBase.isTextMarkupAnnotationModule()) { | ||
// tslint:disable-next-line | ||
var stampData = printImage['stampAnnotations']; | ||
if (proxy.pdfViewerBase.isImportAction) { | ||
var importAnnotationList = proxy.pdfViewerBase.importedAnnotation; | ||
// tslint:disable-next-line | ||
var importAnnotation = importAnnotationList[printImage.pageNumber]; | ||
var textMarkupAnnotation = printImage.textMarkupAnnotation; | ||
var shapeAnnotation = printImage.shapeAnnotation; | ||
var measureShapeAnnotation = printImage.measureShapeAnnotation; | ||
var stampAnnotation = stampData; | ||
// tslint:disable-next-line | ||
var stickyNoteAnnotation = printImage.stickyNotesAnnotation; | ||
if (importAnnotation) { | ||
if (importAnnotation.textMarkupAnnotation.length !== 0) { | ||
textMarkupAnnotation = printImage.textMarkupAnnotation.concat(importAnnotation.textMarkupAnnotation); | ||
} | ||
if (importAnnotation.shapeAnnotation.length !== 0) { | ||
shapeAnnotation = printImage.shapeAnnotation.concat(importAnnotation.shapeAnnotation); | ||
} | ||
if (importAnnotation.measureShapeAnnotation.length !== 0) { | ||
measureShapeAnnotation = printImage.measureShapeAnnotation.concat(importAnnotation.measureShapeAnnotation); | ||
} | ||
if (importAnnotation.stampAnnotations.length !== 0) { | ||
stampAnnotation = stampData.concat(importAnnotation.stampAnnotations); | ||
} | ||
if (importAnnotation.stickyNotesAnnotation.length !== 0) { | ||
stickyNoteAnnotation = printImage.stickyNotesAnnotation.concat(importAnnotation.stickyNotesAnnotation); | ||
} | ||
} | ||
// tslint:disable-next-line:max-line-length | ||
annotationSource_1 = proxy.pdfViewer.annotationModule.textMarkupAnnotationModule.printTextMarkupAnnotations(textMarkupAnnotation, pageIndex, stampAnnotation, shapeAnnotation, measureShapeAnnotation, stickyNoteAnnotation); | ||
} | ||
else { | ||
// tslint:disable-next-line:max-line-length | ||
annotationSource_1 = proxy.pdfViewer.annotationModule.textMarkupAnnotationModule.printTextMarkupAnnotations(printImage.textMarkupAnnotation, pageIndex, stampData, printImage.shapeAnnotation, printImage.measureShapeAnnotation, printImage.stickyNoteAnnotation); | ||
} | ||
} | ||
else { | ||
// translate to center canvas | ||
context.translate(proxy.printCanvas.width * 0.5, proxy.printCanvas.height * 0.5); | ||
// rotate the canvas to - 90 degree | ||
context.rotate(-0.5 * Math.PI); | ||
// un translate the canvas back to origin | ||
context.translate(-proxy.printCanvas.height * 0.5, -proxy.printCanvas.width * 0.5); | ||
// draw the image | ||
context.drawImage(pageImage, 0, 0, proxy.printCanvas.height, proxy.printCanvas.width); | ||
if (annotationSource) { | ||
context.drawImage(annotationImage, 0, 0, proxy.printCanvas.height, proxy.printCanvas.width); | ||
var currentPageNumber_1 = printImage.pageNumber; | ||
// tslint:disable-next-line:max-line-length | ||
proxy.printCanvas = createElement('canvas', { id: proxy.pdfViewer.element.id + '_printCanvas_' + pageIndex, className: 'e-pv-print-canvas' }); | ||
proxy.printCanvas.style.width = pageWidth + 'px'; | ||
proxy.printCanvas.style.height = pageHeight + 'px'; | ||
proxy.printCanvas.height = 1056 * window.devicePixelRatio; | ||
proxy.printCanvas.width = 816 * window.devicePixelRatio; | ||
var context_1 = proxy.printCanvas.getContext('2d'); | ||
var pageImage_1 = new Image(); | ||
var annotationImage_1 = new Image(); | ||
pageImage_1.onload = function () { | ||
if (pageHeight > pageWidth) { | ||
context_1.drawImage(pageImage_1, 0, 0, proxy.printCanvas.width, proxy.printCanvas.height); | ||
if (annotationSource_1) { | ||
context_1.drawImage(annotationImage_1, 0, 0, proxy.printCanvas.width, proxy.printCanvas.height); | ||
} | ||
} | ||
} | ||
if (currentPageNumber === (proxy.pdfViewerBase.pageCount - 1)) { | ||
proxy.printWindowOpen(); | ||
} | ||
proxy.pdfViewer.renderDrawing(null, pageIndex); | ||
}; | ||
pageImage.src = printImage.image; | ||
annotationImage.src = annotationSource; | ||
proxy.printViewerContainer.appendChild(proxy.printCanvas); | ||
else { | ||
// translate to center canvas | ||
context_1.translate(proxy.printCanvas.width * 0.5, proxy.printCanvas.height * 0.5); | ||
// rotate the canvas to - 90 degree | ||
context_1.rotate(-0.5 * Math.PI); | ||
// un translate the canvas back to origin | ||
context_1.translate(-proxy.printCanvas.height * 0.5, -proxy.printCanvas.width * 0.5); | ||
// draw the image | ||
context_1.drawImage(pageImage_1, 0, 0, proxy.printCanvas.height, proxy.printCanvas.width); | ||
if (annotationSource_1) { | ||
context_1.drawImage(annotationImage_1, 0, 0, proxy.printCanvas.height, proxy.printCanvas.width); | ||
} | ||
} | ||
if (currentPageNumber_1 === (proxy.pdfViewerBase.pageCount - 1)) { | ||
proxy.printWindowOpen(); | ||
} | ||
proxy.pdfViewer.renderDrawing(null, pageIndex); | ||
}; | ||
pageImage_1.src = printImage.image; | ||
annotationImage_1.src = annotationSource_1; | ||
proxy.printViewerContainer.appendChild(proxy.printCanvas); | ||
} | ||
}; | ||
// tslint:disable-next-line | ||
this.printRequestHandler.onFailure = function (result) { | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, proxy.pdfViewer.serverActionSettings.print); | ||
}; | ||
@@ -121,3 +170,3 @@ // tslint:disable-next-line | ||
proxy.pdfViewerBase.openNotificationPopup(); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, proxy.pdfViewer.serverActionSettings.print); | ||
}; | ||
@@ -124,0 +173,0 @@ }; |
@@ -71,9 +71,7 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private getSearchPage; | ||
private convertMatches; | ||
private highlightSearchedTexts; | ||
private beginText; | ||
private addSpanForSearch; | ||
private addDivForSearch; | ||
private addDivElement; | ||
private createSearchTextDiv; | ||
private isClassAvailable; | ||
private addSpan; | ||
private searchOnSelection; | ||
private getScrollElement; | ||
@@ -84,8 +82,15 @@ private scrollToSearchStr; | ||
*/ | ||
resizeSearchElements(pageIndex: number): void; | ||
/** | ||
* @private | ||
*/ | ||
highlightOtherOccurrences(pageNumber: number): void; | ||
private highlightOthers; | ||
private clearAllOccurrences; | ||
/** | ||
* @private | ||
*/ | ||
clearAllOccurrences(): void; | ||
/** | ||
* @private | ||
*/ | ||
getIndexes(): any; | ||
@@ -92,0 +97,0 @@ private applyTextSelection; |
@@ -1,2 +0,2 @@ | ||
import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { CheckBox } from '@syncfusion/ej2-buttons'; | ||
@@ -203,4 +203,5 @@ import { AjaxHandler } from '../index'; | ||
if (inputString !== '') { | ||
if (this.searchCollection[this.searchPageIndex] && inputString === this.searchString) { | ||
if (this.searchCollection[this.searchPageIndex].length === 0) { | ||
// tslint:disable-next-line | ||
if (this.searchMatches[this.searchPageIndex] && inputString === this.searchString) { | ||
if (this.searchMatches[this.searchPageIndex].length === 0) { | ||
this.initSearch(this.searchPageIndex, false); | ||
@@ -234,5 +235,5 @@ } | ||
this.searchIndex = this.searchIndex + 1; | ||
if (this.searchCollection[this.searchPageIndex]) { | ||
if (this.searchMatches[this.searchPageIndex]) { | ||
// tslint:disable-next-line:max-line-length | ||
if (this.searchIndex >= this.searchCollection[this.searchPageIndex].length || this.searchPageIndex !== this.pdfViewerBase.currentPageNumber - 1) { | ||
if (this.searchIndex >= this.searchMatches[this.searchPageIndex].length || this.searchPageIndex !== this.pdfViewerBase.currentPageNumber - 1) { | ||
this.searchIndex = 0; | ||
@@ -282,2 +283,4 @@ this.searchPageIndex = ((this.searchPageIndex + 1) < this.pdfViewerBase.pageCount) ? (this.searchPageIndex + 1) : 0; | ||
var textContents = null; | ||
// tslint:disable-next-line | ||
var characterBounds = null; | ||
if (storedData) { | ||
@@ -288,4 +291,5 @@ // tslint:disable-next-line | ||
textContents = storedData['textContent']; | ||
characterBounds = this.pdfViewerBase.textLayer.characterBound[pageIndex]; | ||
this.textContents[pageIndex] = textContents; | ||
this.getPossibleMatches(pageIndex, this.searchString, pageText, textContents, isSinglePageSearch); | ||
this.getPossibleMatches(pageIndex, this.searchString, pageText, textContents, isSinglePageSearch, characterBounds); | ||
} | ||
@@ -298,4 +302,4 @@ else { | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
TextSearch.prototype.getPossibleMatches = function (pageIndex, searchString, pageString, textContents, isSinglePageSearch) { | ||
// tslint:disable-next-line | ||
TextSearch.prototype.getPossibleMatches = function (pageIndex, searchString, pageString, textContents, isSinglePageSearch, characterBounds) { | ||
var pageText = pageString; | ||
@@ -310,2 +314,3 @@ var searchText = searchString; | ||
var matchIndex = -queryLength; | ||
var newIndex = -queryLength; | ||
while (matchIndex !== 0) { | ||
@@ -316,6 +321,20 @@ if (searchText === '' || searchText === ' ' || !searchText) { | ||
matchIndex = pageText.indexOf(searchText, matchIndex + queryLength); | ||
if (matchIndex === -1) { | ||
if (searchText.indexOf(' ') !== -1) { | ||
var newString = searchString.replace(' ', '\r\n'); | ||
newIndex = pageText.indexOf(newString, newIndex + queryLength); | ||
if (!(newIndex <= -1)) { | ||
if (newIndex < matchIndex) { | ||
matches.push(newIndex); | ||
} | ||
} | ||
} | ||
if (matchIndex <= -1 && newIndex <= -1) { | ||
break; | ||
} | ||
matches.push(matchIndex); | ||
if (!(matchIndex <= -1)) { | ||
matches.push(matchIndex); | ||
} | ||
if (newIndex > matchIndex && !(newIndex <= -1)) { | ||
matches.push(newIndex); | ||
} | ||
} | ||
@@ -336,3 +355,3 @@ this.searchMatches[pageIndex] = matches; | ||
// tslint:disable-next-line:max-line-length | ||
if (this.searchCollection.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (this.searchPageIndex) === this.currentSearchIndex) { | ||
if (this.searchMatches.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (this.searchPageIndex) === this.currentSearchIndex) { | ||
if (!this.isMessagePopupOpened) { | ||
@@ -347,3 +366,3 @@ this.onMessageBoxOpen(); | ||
} | ||
this.convertMatches(pageIndex, queryLength, textContents, isSinglePageSearch); | ||
this.highlightSearchedTexts(pageIndex, isSinglePageSearch); | ||
} | ||
@@ -364,3 +383,3 @@ else { | ||
// tslint:disable-next-line:max-line-length | ||
if (!this.searchCollection[this.searchPageIndex] && this.searchCollection.length === 0 && this.searchedPages.length === this.pdfViewerBase.pageCount) { | ||
if (!this.searchMatches[this.searchPageIndex] && this.searchMatches.length === 0 && this.searchedPages.length === this.pdfViewerBase.pageCount) { | ||
// tslint:disable-next-line:max-line-length | ||
@@ -372,3 +391,3 @@ if (!this.isMessagePopupOpened) { | ||
} | ||
else if (this.searchCollection.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (searchPageIndex) === this.currentSearchIndex) { | ||
else if (this.searchMatches.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (searchPageIndex) === this.currentSearchIndex) { | ||
if (this.isPrevSearch) { | ||
@@ -379,3 +398,3 @@ // tslint:disable-next-line:max-line-length | ||
} | ||
this.searchPageIndex = this.getSearchPage(this.pdfViewerBase.currentPageNumber - 1); | ||
this.searchPageIndex = searchPageIndex; | ||
this.searchedPages = []; | ||
@@ -388,3 +407,3 @@ this.searchIndex = -1; | ||
} | ||
this.searchPageIndex = this.getSearchPage(this.pdfViewerBase.currentPageNumber - 1); | ||
this.searchPageIndex = searchPageIndex; | ||
this.searchedPages = []; | ||
@@ -403,3 +422,3 @@ this.searchIndex = 0; | ||
for (var i = pageIndex; i >= 0; i--) { | ||
if (i !== pageIndex && this.searchCollection[i]) { | ||
if (i !== pageIndex && this.searchMatches[i]) { | ||
pageNumber = i; | ||
@@ -411,3 +430,3 @@ break; | ||
for (var j = this.pdfViewerBase.pageCount - 1; j > pageIndex; j--) { | ||
if (this.searchCollection[j]) { | ||
if (this.searchMatches[j]) { | ||
pageNumber = j; | ||
@@ -421,3 +440,3 @@ break; | ||
for (var i = pageIndex; i < this.pdfViewerBase.pageCount; i++) { | ||
if (i !== pageIndex && this.searchCollection[i]) { | ||
if (i !== pageIndex && this.searchMatches[i]) { | ||
pageNumber = i; | ||
@@ -429,3 +448,3 @@ break; | ||
for (var j = 0; j < pageIndex; j++) { | ||
if (this.searchCollection[j]) { | ||
if (this.searchMatches[j]) { | ||
pageNumber = j; | ||
@@ -439,39 +458,5 @@ break; | ||
}; | ||
TextSearch.prototype.convertMatches = function (pageIndex, queryLength, textContents, isSinglePageSearch) { | ||
var m = 0; | ||
TextSearch.prototype.highlightSearchedTexts = function (pageIndex, isSinglePageSearch) { | ||
// tslint:disable-next-line | ||
var matches = this.searchMatches[pageIndex]; | ||
var divIndex = 0; | ||
var end = textContents.length - 1; | ||
var matchCollection = []; | ||
for (var i = 0; i < matches.length; i++) { | ||
var matchIndex = matches[i]; | ||
while (m !== end && matchIndex >= (divIndex + textContents[m].split('\r\n')[0].length)) { | ||
divIndex += textContents[m].split('\r\n')[0].length; | ||
m++; | ||
} | ||
var match = { | ||
begin: { | ||
divId: m, | ||
offsetValue: matchIndex - divIndex, | ||
} | ||
}; | ||
matchIndex += queryLength; | ||
while (m !== end && matchIndex > (divIndex + textContents[m].length)) { | ||
divIndex += textContents[m].length; | ||
m++; | ||
} | ||
match.end = { | ||
divId: m, | ||
offsetValue: matchIndex - divIndex, | ||
}; | ||
matchCollection.push(match); | ||
} | ||
if (this.searchCollection.length === 0) { | ||
this.currentSearchIndex = pageIndex; | ||
} | ||
this.searchCollection[pageIndex] = matchCollection; | ||
this.highlightSearchedTexts(pageIndex, isSinglePageSearch); | ||
}; | ||
TextSearch.prototype.highlightSearchedTexts = function (pageIndex, isSinglePageSearch) { | ||
var matches = this.searchCollection[pageIndex]; | ||
var prevEnd = null; | ||
@@ -482,97 +467,98 @@ // tslint:disable-next-line | ||
var className; | ||
for (var i = 0; i < matches.length; i++) { | ||
var match = matches[i]; | ||
// tslint:disable-next-line | ||
var start = match.begin; | ||
// tslint:disable-next-line | ||
var end = match.end; | ||
if (i === this.searchIndex && pageIndex === this.searchPageIndex) { | ||
className = 'e-pv-search-text-highlight'; | ||
startId = start.divId; | ||
} | ||
else { | ||
className = 'e-pv-search-text-highlightother'; | ||
} | ||
if (!prevEnd || start.divId !== prevEnd.divId) { | ||
if (prevEnd !== null) { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), undefined, null); | ||
// tslint:disable-next-line | ||
var characterBounds = this.pdfViewerBase.textLayer.characterBound[pageIndex]; | ||
if (characterBounds) { | ||
for (var i = 0; i < matches.length; i++) { | ||
if (i === this.searchIndex && pageIndex === this.searchPageIndex) { | ||
className = 'e-pv-search-text-highlight'; | ||
} | ||
this.beginText(start, pageIndex, null); | ||
else { | ||
className = 'e-pv-search-text-highlightother'; | ||
} | ||
this.addDivForSearch(i, pageIndex, characterBounds, this.searchString.length, className); | ||
} | ||
else { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), parseFloat(start.offsetValue.toString()), null); | ||
} | ||
if (start.divId === end.divId) { | ||
this.addSpanForSearch(pageIndex, start.divId, start.offsetValue, end.offsetValue, className); | ||
} | ||
else { | ||
this.addSpanForSearch(pageIndex, start.divId, start.offsetValue, undefined, className); | ||
for (var k = start.divId + 1; k < end.divId; k++) { | ||
this.addSpanForSearch(pageIndex, k, 0, undefined, className + ' middle'); | ||
if (pageIndex === this.searchPageIndex && !isSinglePageSearch) { | ||
var element = this.pdfViewerBase.getElement('_searchtext_' + pageIndex + '_' + this.searchIndex); | ||
if (element) { | ||
var targetScrollElement = this.getScrollElement(element); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
this.beginText(end, pageIndex, className); | ||
else { | ||
this.pdfViewerBase.updateScrollTop(pageIndex); | ||
var element_1 = this.pdfViewerBase.getElement('_searchtext_' + pageIndex + '_' + this.searchIndex); | ||
if (element_1) { | ||
var targetScrollElement = this.getScrollElement(element_1); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
} | ||
} | ||
prevEnd = end; | ||
} | ||
if (prevEnd) { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), undefined, null); | ||
}; | ||
// tslint:disable-next-line | ||
TextSearch.prototype.addDivForSearch = function (index, pageIndex, characterBounds, queryLength, className) { | ||
var textLayer = this.pdfViewerBase.getElement('_textLayer_' + pageIndex); | ||
if (isNullOrUndefined(textLayer) && className === 'e-pv-search-text-highlight') { | ||
this.pdfViewer.navigation.goToPage(pageIndex + 1); | ||
} | ||
if (pageIndex === this.searchPageIndex && !isSinglePageSearch) { | ||
var element = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + startId); | ||
if (element) { | ||
var targetScrollElement = this.getScrollElement(element); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
else { | ||
this.pdfViewerBase.updateScrollTop(pageIndex); | ||
var element_1 = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + startId); | ||
var targetScrollElement = this.getScrollElement(element_1); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
var count = this.searchMatches[pageIndex][index]; | ||
var initial = count; | ||
var divCount = 0; | ||
while (count < initial + queryLength) { | ||
count = this.addDivElement(count, characterBounds, queryLength, className, index, pageIndex, initial, divCount); | ||
divCount++; | ||
} | ||
}; | ||
// tslint:disable-next-line | ||
TextSearch.prototype.beginText = function (start, pageIndex, className) { | ||
var divIndex = parseFloat(start.divId); | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + divIndex); | ||
if (textDiv) { | ||
TextSearch.prototype.addDivElement = function (count, characterBounds, queryLength, className, index, pageIndex, initial, divCount) { | ||
var height = 0; | ||
var width = 0; | ||
var top = 0; | ||
var left = 0; | ||
left = characterBounds[count].X; | ||
top = characterBounds[count].Y; | ||
var v = 0; | ||
if ((count - initial) !== 0) { | ||
v = count - initial; | ||
queryLength += 1; | ||
} | ||
for (v = v; v < queryLength; v++) { | ||
// tslint:disable-next-line | ||
this.tempElementStorage = new Array(); | ||
for (var i = 0; i < textDiv.childNodes.length; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
var ele = { text: textDiv.childNodes[i].textContent, classString: textDiv.childNodes[i].className }; | ||
this.tempElementStorage.push(ele); | ||
var charBound = characterBounds[count]; | ||
if (left > charBound.X) { | ||
break; | ||
} | ||
textDiv.textContent = ''; | ||
this.addSpanForSearch(pageIndex, divIndex, 0, start.offsetValue, className); | ||
top = (top < charBound.Y) ? top : charBound.Y; | ||
var topDifference = (top < charBound.Y) ? (charBound.Y - top) : (top - charBound.Y); | ||
height = (height > (topDifference + charBound.Height)) ? height : (topDifference + charBound.Height); | ||
count++; | ||
} | ||
var isContinuation = false; | ||
if (initial + queryLength !== count) { | ||
isContinuation = true; | ||
width = (characterBounds[count - 1].X - left); | ||
} | ||
else { | ||
isContinuation = false; | ||
width = (characterBounds[count].X - left); | ||
} | ||
this.createSearchTextDiv(index, pageIndex, height, width, top, left, className, isContinuation, divCount); | ||
return count; | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
TextSearch.prototype.addSpanForSearch = function (pageIndex, divIndex, fromOffset, toOffset, className) { | ||
var divTextContent; | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + divIndex); | ||
if (textDiv) { | ||
var textContent = this.textContents[pageIndex]; | ||
divTextContent = textContent[divIndex].substring(fromOffset, toOffset); | ||
var node = document.createTextNode(divTextContent); | ||
if (className) { | ||
var spanElement = document.createElement('span'); | ||
spanElement.className = className; | ||
if (spanElement.classList.contains('middle')) { | ||
textDiv.textContent = ''; | ||
} | ||
spanElement.appendChild(node); | ||
textDiv.appendChild(spanElement); | ||
// tslint:disable-next-line | ||
TextSearch.prototype.createSearchTextDiv = function (index, pageIndex, height, width, top, left, className, isContinuation, divCount) { | ||
var idString = '_searchtext_' + pageIndex + '_' + index; | ||
if (isContinuation) { | ||
idString += '_' + divCount; | ||
} | ||
if (!this.pdfViewerBase.getElement(idString)) { | ||
var textDiv = createElement('div', { id: this.pdfViewer.element.id + idString }); | ||
textDiv.style.height = height * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.width = width * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.top = top * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.left = left * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.classList.add(className); | ||
var textLayer = this.pdfViewerBase.getElement('_textLayer_' + pageIndex); | ||
if (textLayer) { | ||
textLayer.appendChild(textDiv); | ||
} | ||
else { | ||
if (this.pdfViewer.textSelectionModule.isTextSelection) { | ||
this.searchOnSelection(textDiv, node, divTextContent); | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
} | ||
@@ -593,175 +579,2 @@ }; | ||
}; | ||
TextSearch.prototype.addSpan = function (text, textDiv) { | ||
var newNode = document.createTextNode(text); | ||
var spanElement = document.createElement('span'); | ||
spanElement.className = 'e-pv-maintaincontent'; | ||
spanElement.appendChild(newNode); | ||
textDiv.appendChild(spanElement); | ||
}; | ||
TextSearch.prototype.searchOnSelection = function (textDiv, node, divTextContent) { | ||
if (this.tempElementStorage.length === 1) { | ||
if (this.tempElementStorage[0].classString) { | ||
if (this.tempElementStorage[0].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(node.textContent, textDiv); | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage.length > 1) { | ||
for (var i = 0; i < this.tempElementStorage.length; i++) { | ||
if (this.tempElementStorage[i].classString) { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
if (this.tempElementStorage[i].text === node.textContent) { | ||
this.addSpan(node.textContent, textDiv); | ||
break; | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text !== node.textContent) { | ||
var currentString = node.textContent; | ||
var isClassAvailable = this.isClassAvailable(); | ||
var subString = void 0; | ||
if (isClassAvailable) { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} | ||
else { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(currentString) !== -1 && !this.tempElementStorage[i].classString) { | ||
this.addSpan(currentString, textDiv); | ||
break; // tslint:disable-next-line | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && this.tempElementStorage[i].classString && subString !== '') { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(subString, textDiv); // tslint:disable-next-line | ||
var nextSubString = divTextContent.substring(this.tempElementStorage[i].text.length, divTextContent.length); | ||
if (this.tempElementStorage[i + 1]) { // tslint:disable-next-line | ||
if (this.tempElementStorage[i + 1].text.indexOf(nextSubString) !== -1 && !this.tempElementStorage[i + 1].classString && nextSubString !== "") { | ||
node.textContent = nextSubString; | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
else if (this.tempElementStorage[i + 1]) { | ||
if (divTextContent === (this.tempElementStorage[i].text + this.tempElementStorage[i + 1].text)) { | ||
this.addSpan(this.tempElementStorage[i].text, textDiv); | ||
node.textContent = this.tempElementStorage[i + 1].text; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(divTextContent) !== -1) { | ||
this.addSpan(divTextContent, textDiv); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
var subString_1 = this.tempElementStorage[i].text.substring(textDiv.textContent.length, currentString.length); | ||
if (this.tempElementStorage[i].text.indexOf(subString_1) !== -1 && this.tempElementStorage[i].classString && // tslint:disable-next-line | ||
subString_1 !== '' && !this.tempElementStorage[i + 1].classString && divTextContent.indexOf(subString_1) !== -1) { | ||
this.addSpan(subString_1, textDiv); | ||
continue; | ||
} | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text.indexOf(divTextContent) !== -1) { | ||
this.addSpan(node.textContent, textDiv); | ||
break; | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(divTextContent.replace('\r\n', '')) !== -1) { | ||
this.addSpan(divTextContent, textDiv); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text !== node.textContent) { | ||
var currentString = node.textContent; | ||
if (currentString !== '') { | ||
var isClassAvailable = this.isClassAvailable(); | ||
var subString = void 0; | ||
if (isClassAvailable) { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} | ||
else { // tslint:disable-next-line | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length - textDiv.textContent.length); | ||
} // tslint:disable-next-line | ||
if (subString === currentString && !this.tempElementStorage[i].classString && this.tempElementStorage[i].text.indexOf(subString) !== -1) { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && this.tempElementStorage[i].classString) { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(subString, textDiv); | ||
break; | ||
} | ||
} | ||
else if (this.tempElementStorage[i + 1]) { // tslint:disable-next-line | ||
var balanceString = currentString.substring(this.tempElementStorage[i].text.length, currentString.length); | ||
var nextString = this.tempElementStorage[i + 1].text.substring(0, balanceString.length); | ||
if (currentString === (subString + this.tempElementStorage[i + 1].text)) { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
this.addSpan(this.tempElementStorage[i + 1].text, textDiv); | ||
break; | ||
} | ||
else if (currentString === (subString + nextString) && nextString !== '') { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
this.addSpan(balanceString, textDiv); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && !this.tempElementStorage[i].classString && subString !== '') { | ||
var newSubString = divTextContent.substring(0, subString.length); | ||
node.textContent = newSubString; | ||
textDiv.appendChild(node); // tslint:disable-next-line | ||
var nextNewSubString = divTextContent.substring(subString.length, divTextContent.length); | ||
if (nextNewSubString !== '' && this.tempElementStorage[i + 1].text.indexOf(nextNewSubString) !== -1 && this.tempElementStorage[i + 1].classString) { | ||
this.addSpan(nextNewSubString, textDiv); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(currentString) !== -1 && !this.tempElementStorage[i].classString) { | ||
node.textContent = currentString; | ||
textDiv.appendChild(node); | ||
break; // tslint:disable-next-line | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(currentString.replace('\r\n', '')) !== -1 && !this.tempElementStorage[i].classString) { | ||
node.textContent = currentString; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else { | ||
if (divTextContent.indexOf(this.tempElementStorage[i].text) !== -1) { | ||
node.textContent = this.tempElementStorage[i].text; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
}; | ||
TextSearch.prototype.getScrollElement = function (element) { | ||
@@ -808,2 +621,19 @@ var targetElement = element; | ||
*/ | ||
TextSearch.prototype.resizeSearchElements = function (pageIndex) { | ||
var searchDivs = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_searchtext_' + pageIndex + '"]'); | ||
for (var i = 0; i < searchDivs.length; i++) { | ||
var textDiv = searchDivs[i]; | ||
// tslint:disable-next-line | ||
textDiv.style.width = (parseFloat(textDiv.style.width) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.height = (parseFloat(textDiv.style.height) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.top = (parseFloat(textDiv.style.top) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.left = (parseFloat(textDiv.style.left) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
} | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
TextSearch.prototype.highlightOtherOccurrences = function (pageNumber) { | ||
@@ -820,5 +650,10 @@ this.initSearch(pageNumber, true); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
TextSearch.prototype.clearAllOccurrences = function () { | ||
this.pdfViewerBase.textLayer.clearDivSelection(); | ||
this.applyTextSelection(); | ||
var searchTextDivs = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_searchtext_"]'); | ||
for (var i = 0; i < searchTextDivs.length; i++) { | ||
searchTextDivs[i].parentElement.removeChild(searchTextDivs[i]); | ||
} | ||
}; | ||
@@ -869,3 +704,7 @@ /** | ||
// tslint:disable-next-line:max-line-length | ||
jsonObject = { xCoordinate: 0, yCoordinate: 0, pageNumber: pageIndex, documentId: proxy.pdfViewerBase.getDocumentId(), hashId: proxy.pdfViewerBase.hashId, zoomFactor: proxy.pdfViewerBase.getZoomFactor(), action: 'RenderPdfPages' }; | ||
jsonObject = { xCoordinate: 0, yCoordinate: 0, pageNumber: pageIndex, documentId: proxy.pdfViewerBase.getDocumentId(), hashId: proxy.pdfViewerBase.hashId, zoomFactor: proxy.pdfViewerBase.getZoomFactor(), action: 'RenderPdfPages', elementId: proxy.pdfViewer.element.id }; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// tslint:disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
this.searchRequestHandler = new AjaxHandler(this.pdfViewer); | ||
@@ -880,3 +719,9 @@ this.searchRequestHandler.url = this.pdfViewer.serviceUrl + '/' + this.pdfViewer.serverActionSettings.renderPages; | ||
if (typeof data !== 'object') { | ||
data = JSON.parse(data); | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
catch (error) { | ||
proxy.pdfViewerBase.onControlError(500, data, this.pdfViewer.serverActionSettings.renderPages); | ||
data = null; | ||
} | ||
} | ||
@@ -892,3 +737,3 @@ if (data) { | ||
this.searchRequestHandler.onFailure = function (result) { | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, this.pdfViewer.serverActionSettings.renderPages); | ||
}; | ||
@@ -898,3 +743,3 @@ // tslint:disable-next-line | ||
proxy.pdfViewerBase.openNotificationPopup(); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, this.pdfViewer.serverActionSettings.renderPages); | ||
}; | ||
@@ -937,4 +782,2 @@ }; | ||
this.searchMatches = new Array(); | ||
// tslint:disable-next-line | ||
this.searchCollection = new Array(); | ||
}; | ||
@@ -1015,3 +858,3 @@ /** | ||
TextSearch.prototype.destroy = function () { | ||
this.searchCollection = undefined; | ||
this.searchMatches = undefined; | ||
}; | ||
@@ -1018,0 +861,0 @@ /** |
@@ -62,2 +62,3 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private topStoreRight; | ||
private isTextSearched; | ||
/** | ||
@@ -109,3 +110,3 @@ * @private | ||
*/ | ||
textSelectionOnMouseup(): void; | ||
textSelectionOnMouseup(event: MouseEvent): void; | ||
/** | ||
@@ -173,3 +174,6 @@ * @private | ||
private createTouchSelectElement; | ||
private calculateContextMenuPosition; | ||
/** | ||
* @private | ||
*/ | ||
calculateContextMenuPosition(top: any, left: any): any; | ||
private onLeftTouchSelectElementTouchStart; | ||
@@ -176,0 +180,0 @@ private onRightTouchSelectElementTouchStart; |
@@ -124,3 +124,7 @@ import { AjaxHandler } from '../index'; | ||
// tslint:disable-next-line:max-line-length | ||
var jsonObject = { startPage: proxy.startIndex, endPage: proxy.thumbnailLimit, sizeX: 99.7, sizeY: 141, hashId: proxy.pdfViewerBase.hashId, action: 'RenderThumbnailImages' }; | ||
var jsonObject = { startPage: proxy.startIndex, endPage: proxy.thumbnailLimit, sizeX: 99.7, sizeY: 141, hashId: proxy.pdfViewerBase.hashId, action: 'RenderThumbnailImages', elementId: proxy.pdfViewer.element.id }; | ||
if (this.pdfViewerBase.jsonDocumentId) { | ||
// tslint:disable-next-line | ||
jsonObject.documentId = this.pdfViewerBase.jsonDocumentId; | ||
} | ||
this.thumbnailRequestHandler = new AjaxHandler(this.pdfViewer); | ||
@@ -135,8 +139,17 @@ this.thumbnailRequestHandler.url = proxy.pdfViewer.serviceUrl + '/' + proxy.pdfViewer.serverActionSettings.renderThumbnail; | ||
if (typeof data !== 'object') { | ||
data = JSON.parse(data); | ||
try { | ||
data = JSON.parse(data); | ||
} | ||
catch (error) { | ||
proxy.pdfViewerBase.onControlError(500, data, proxy.pdfViewer.serverActionSettings.renderThumbnail); | ||
data = null; | ||
} | ||
} | ||
proxy.renderThumbnailImage(data); | ||
if (!proxy.isThumbnailCompleted) { | ||
proxy.startIndex = data.endPage; | ||
proxy.isThumbnailCompleted = true; | ||
if (data) { | ||
proxy.renderThumbnailImage(data); | ||
if (!proxy.isThumbnailCompleted) { | ||
var index = (data && isNaN(data.endPage)) ? data.endPage : proxy.thumbnailLimit; | ||
proxy.startIndex = index; | ||
proxy.isThumbnailCompleted = true; | ||
} | ||
} | ||
@@ -146,3 +159,3 @@ }; | ||
this.thumbnailRequestHandler.onFailure = function (result) { | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, proxy.pdfViewer.serverActionSettings.renderThumbnail); | ||
}; | ||
@@ -152,3 +165,3 @@ // tslint:disable-next-line | ||
proxy.pdfViewerBase.openNotificationPopup(); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText); | ||
proxy.pdfViewer.fireAjaxRequestFailed(result.status, result.statusText, proxy.pdfViewer.serverActionSettings.renderThumbnail); | ||
}; | ||
@@ -227,3 +240,5 @@ }; | ||
if (this.thumbnailView) { | ||
for (var i = data.startPage; i < data.endPage; i++) { | ||
var startPage = (data && isNaN(data.startPage)) ? data.startPage : this.startIndex; | ||
var endPage = (data && isNaN(data.endPage)) ? data.endPage : this.thumbnailLimit; | ||
for (var i = startPage; i < endPage; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
@@ -230,0 +245,0 @@ var pageLink = createElement('a', { id: 'page_' + i, attrs: { 'aria-label': 'Thumbnail of Page' + (i + 1), 'tabindex': '-1', 'role': 'link' } }); |
@@ -33,2 +33,3 @@ import { PdfViewer, PdfViewerBase, Toolbar } from '../index'; | ||
private calibrateDropDown; | ||
private commentItem; | ||
private closeItem; | ||
@@ -141,13 +142,20 @@ private opacityIndicator; | ||
private applyHideToToolbar; | ||
private adjustViewer; | ||
/** | ||
* @private | ||
*/ | ||
adjustViewer(isAdjust: boolean): void; | ||
private updateContentContainerHeight; | ||
private getToolbarHeight; | ||
private getHeight; | ||
private getNavigationToolbarHeight; | ||
private handleHighlight; | ||
private handleUnderline; | ||
private handleStrikethrough; | ||
private deselectAllItems; | ||
/** | ||
* @private | ||
*/ | ||
deselectAllItems(): void; | ||
private updateInteractionTools; | ||
/** | ||
* @private | ||
*/ | ||
selectAnnotationDeleteItem(isEnable: boolean): void; | ||
@@ -154,0 +162,0 @@ /** |
@@ -240,2 +240,3 @@ import { PdfViewer, PdfViewerBase, AnnotationToolbar } from '../index'; | ||
private applyToolbarSettings; | ||
private getStampMode; | ||
/** | ||
@@ -242,0 +243,0 @@ * @private |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20177218
139428
+ Added@syncfusion/ej2-base@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-buttons@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-calendars@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-data@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-drawings@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-dropdowns@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-icons@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-inplace-editor@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-inputs@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-lists@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-navigations@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-notifications@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-popups@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-richtexteditor@17.2.29-beta(transitive)
+ Added@syncfusion/ej2-splitbuttons@17.2.29-beta(transitive)
- Removed@syncfusion/ej2-base@17.2.49(transitive)
- Removed@syncfusion/ej2-buttons@17.2.47(transitive)
- Removed@syncfusion/ej2-calendars@17.2.49(transitive)
- Removed@syncfusion/ej2-data@17.2.47(transitive)
- Removed@syncfusion/ej2-drawings@17.2.47(transitive)
- Removed@syncfusion/ej2-dropdowns@17.2.49(transitive)
- Removed@syncfusion/ej2-icons@17.2.47(transitive)
- Removed@syncfusion/ej2-inplace-editor@17.2.51(transitive)
- Removed@syncfusion/ej2-inputs@17.2.52(transitive)
- Removed@syncfusion/ej2-lists@17.2.47(transitive)
- Removed@syncfusion/ej2-navigations@17.2.49(transitive)
- Removed@syncfusion/ej2-notifications@17.2.47(transitive)
- Removed@syncfusion/ej2-popups@17.2.47(transitive)
- Removed@syncfusion/ej2-richtexteditor@17.2.52(transitive)
- Removed@syncfusion/ej2-splitbuttons@17.2.47(transitive)