@vitrosoftware/common-ui-ts 1.1.227 → 1.1.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/std/controls/alert/alert.css +10 -47
- package/css/std/controls/bim-viewer/bim-viewer-index.css +4 -0
- package/css/std/controls/bim-viewer/style.css +4 -0
- package/css/std/controls/dialog/dialog-content.css +3 -0
- package/css/std/controls/dialog/dialog-footer.css +2 -0
- package/css/std/controls/dxf-viewer/common.css +4 -0
- package/css/std/controls/dxf-viewer/dxf-viewer-index.css +4 -0
- package/css/std/controls/field-iterator/field-iterator.css +6 -0
- package/css/std/controls/file/file.css +5 -4
- package/css/std/controls/filter/filter.css +1 -1
- package/css/std/controls/lookup-picker/lookup-picker-selected-item.css +0 -1
- package/css/std/controls/lookup-picker/lookup-picker-value-list.css +0 -1
- package/css/std/controls/lookup-picker/lookup-picker.css +38 -21
- package/css/std/controls/pdf-viewer/custom.css +4 -0
- package/css/std/controls/pdf-viewer/img/compare-dlg-separator.svg +3 -1
- package/css/std/controls/pdf-viewer/img/compare-dlg-title.svg +12 -0
- package/css/std/controls/pdf-viewer/pdf-viewer-index.css +217 -0
- package/css/std/controls/pdf-viewer/pdf-viewer.css +213 -0
- package/css/std/controls/select/select.css +26 -2
- package/css/std/controls/tab-group/tab-group.css +6 -3
- package/css/std/controls/table-view/table-view-custom-lookup-edit.css +1 -1
- package/css/std/controls/table-view/treegrid-cell.css +5 -0
- package/css/std/controls/table-view/treegrid-context-menu.css +22 -3
- package/css/std/controls/video-viewer/video-viewer.css +1 -1
- package/dist/index.css +98 -82
- package/dist/index.js +451 -337
- package/dist/index.js.map +1 -1
- package/dist/src/constants/Factory.d.ts +1 -0
- package/dist/src/controls/Alert/Alert.d.ts +0 -4
- package/dist/src/controls/Dialog/Dialog.d.ts +2 -0
- package/dist/src/controls/Dialog/DialogContent.d.ts +1 -0
- package/dist/src/controls/LookupPicker/LookupPicker.d.ts +2 -0
- package/dist/src/controls/LookupPicker/RightButtonGroup.d.ts +2 -2
- package/dist/src/controls/LookupPicker/ValueList.d.ts +2 -0
- package/dist/src/controls/PdfViewer/services/PdfViewerService.d.ts +8 -0
- package/dist/src/controls/ScrollBar/ScrollBar.d.ts +4 -3
- package/dist/src/controls/Search/Search.d.ts +3 -2
- package/dist/src/controls/TabGroup/Tab.d.ts +3 -3
- package/dist/src/controls/TabGroup/TabGroup.d.ts +0 -1
- package/dist/src/controls/TabGroup/TabGroupComponent.d.ts +0 -1
- package/dist/src/controls/TabGroup/models/Tab.d.ts +2 -1
- package/dist/src/controls/TableView/TableView.d.ts +2 -0
- package/dist/src/controls/TableView/TableViewConstants.d.ts +8 -2
- package/dist/src/controls/TableView/models/TableViewMenuItem.d.ts +2 -0
- package/dist/src/controls/TableView/services/TableViewService.d.ts +4 -0
- package/dist/src/controls/TableView/services/impl/TableViewServiceImpl.d.ts +6 -1
- package/dist/src/controls/View/View.d.ts +1 -1
- package/dist/src/controls/ViewPart/ViewPart.d.ts +2 -1
- package/dist/src/models/Item.d.ts +0 -1
- package/dist/src/models/ItemCopyRequest.d.ts +5 -1
- package/dist/src/models/ItemId.d.ts +2 -0
- package/dist/src/services/FileService.d.ts +8 -0
- package/dist/src/services/ItemSelectDialogService.d.ts +1 -1
- package/dist/src/services.d.ts +3 -0
- package/lib/dxf-viewer/OrbitControls.js +6 -2
- package/lib/dxf-viewer/parser/DxfArrayScanner.js +27 -1
- package/lib/dxf-viewer/parser/DxfParser.js +7 -4
- package/lib/fflate/fflate.module.js +2672 -0
- package/package.json +1 -1
- package/src/controls/BimViewer/js/bim-viewer.js +3 -3
- package/src/controls/DxfViewer/js/dxf-viewer.js +153 -48
- package/src/controls/PdfViewer/js/pdf-viewer.js +986 -38
- package/css/std/controls/file/img/file-button-context.svg +0 -6
|
@@ -21208,7 +21208,7 @@ const defaultOptions = {
|
|
|
21208
21208
|
kind: OptionKind.WORKER
|
|
21209
21209
|
},
|
|
21210
21210
|
workerSrc: {
|
|
21211
|
-
value: "resource/pdfViewer/js/pdf.worker.js?version=1.1.
|
|
21211
|
+
value: "resource/pdfViewer/js/pdf.worker.js?version=1.1.228",
|
|
21212
21212
|
kind: OptionKind.WORKER
|
|
21213
21213
|
}
|
|
21214
21214
|
};
|
|
@@ -35538,6 +35538,7 @@ function initZoomPageEvent() {
|
|
|
35538
35538
|
if(e.pageNumber == getCurrentPage()) {
|
|
35539
35539
|
$(document).trigger('needZoom');
|
|
35540
35540
|
}
|
|
35541
|
+
reloadMarkupEditOutlineSettings(e.pageNumber, true);
|
|
35541
35542
|
});
|
|
35542
35543
|
// PDFViewerApplication.eventBus.on('pagechange', function(e) {
|
|
35543
35544
|
// console.log('pagechange', e);
|
|
@@ -37418,6 +37419,13 @@ const EVENT_SEARCH_ISSUE_LIST = 'vitro.search.issue.list';
|
|
|
37418
37419
|
const EVENT_ISSUE_LIST_REFRESH = 'vitro.issue.list.refresh';
|
|
37419
37420
|
const EVENT_ISSUE_LIST_SELECT_ITEM = 'vitro.issue.list.select.item';
|
|
37420
37421
|
const EVENT_ITEM_CHANGED = 'vitro.item.changed';
|
|
37422
|
+
const ITEM_SELECT_DIALOG = 'ItemSelectDialog';
|
|
37423
|
+
const FILE_EXTENSION_PDF = '.pdf';
|
|
37424
|
+
const DOC_A = 'docA';
|
|
37425
|
+
const DOC_B = 'docB';
|
|
37426
|
+
let currentDocFileVersionList;
|
|
37427
|
+
let docAFileVersionList;
|
|
37428
|
+
let docBFileVersionList;
|
|
37421
37429
|
|
|
37422
37430
|
function initContextMenuCanvas() {
|
|
37423
37431
|
var pages = '#viewer .page:not(.has-new-svg)';
|
|
@@ -37442,7 +37450,7 @@ function initContextMenuCanvas() {
|
|
|
37442
37450
|
}
|
|
37443
37451
|
},
|
|
37444
37452
|
build: function ($triggerElement, e) {
|
|
37445
|
-
if ($('.svgsketch-wrap').hasClass('measures')) {
|
|
37453
|
+
if ($('.svgsketch-wrap').hasClass('measures') || (e?.target && $(e?.target)?.hasClass('pdf-note'))) {
|
|
37446
37454
|
return false;
|
|
37447
37455
|
} else {
|
|
37448
37456
|
return {
|
|
@@ -37525,6 +37533,8 @@ function initCompare() {
|
|
|
37525
37533
|
bindCompareDlgPageChange();
|
|
37526
37534
|
bindBtnsCompareDocsSelect();
|
|
37527
37535
|
bindCompareDlgVersionChange();
|
|
37536
|
+
initButtonSelectFileDocA();
|
|
37537
|
+
initButtonSelectFileDocB();
|
|
37528
37538
|
|
|
37529
37539
|
let fileName = context.file.fieldValueMap.name;
|
|
37530
37540
|
$('div.compare-dlg_doc-a_name').text(fileName);
|
|
@@ -37542,26 +37552,8 @@ function initCompare() {
|
|
|
37542
37552
|
}));
|
|
37543
37553
|
});
|
|
37544
37554
|
|
|
37545
|
-
|
|
37546
|
-
|
|
37547
|
-
let loadedVersion = `v${version.name}`;
|
|
37548
|
-
$('#docAVersion').val(loadedVersion);
|
|
37549
|
-
let loadedVersionArray = version.name.split('.');
|
|
37550
|
-
let loadedVersionMinor = loadedVersionArray[1];
|
|
37551
|
-
let loadedVersionMajor = loadedVersionArray[0];
|
|
37552
|
-
if (loadedVersionId != context.currentVersionId) {
|
|
37553
|
-
let lastVersion = context.fileVersionList.find(item => item.id == context.currentVersionId);
|
|
37554
|
-
let lastVersionLabel = `v${lastVersion.name}`;
|
|
37555
|
-
$('#docBVersion').val(lastVersionLabel);
|
|
37556
|
-
} else {
|
|
37557
|
-
if (context.fileVersionList.length > 1) {
|
|
37558
|
-
let previousVersion = context.fileVersionList[1];
|
|
37559
|
-
let previousVersionLabel = `v${previousVersion.name}`;
|
|
37560
|
-
$('#docBVersion').val(previousVersionLabel);
|
|
37561
|
-
} else {
|
|
37562
|
-
$('#docBVersion').val(loadedVersion);
|
|
37563
|
-
}
|
|
37564
|
-
}
|
|
37555
|
+
currentDocFileVersionList = context.fileVersionList;
|
|
37556
|
+
initDocVersion();
|
|
37565
37557
|
$('#docAPage').val(1);
|
|
37566
37558
|
$('#docBPage').val(1);
|
|
37567
37559
|
}
|
|
@@ -37577,14 +37569,12 @@ function getLoadedVersionId() {
|
|
|
37577
37569
|
function showDlgCompare() {
|
|
37578
37570
|
$('.compare-dlg-wrap').show();
|
|
37579
37571
|
|
|
37580
|
-
|
|
37581
|
-
|
|
37582
|
-
|
|
37572
|
+
resetDocFileVersionList();
|
|
37573
|
+
resetDocPage();
|
|
37574
|
+
initDocVersion();
|
|
37583
37575
|
|
|
37584
37576
|
compareObjList = getCompareObjList();
|
|
37585
|
-
|
|
37586
37577
|
loadDocAObj(compareObjList.docA.url);
|
|
37587
|
-
|
|
37588
37578
|
loadDocBObj(compareObjList.docB.url);
|
|
37589
37579
|
}
|
|
37590
37580
|
|
|
@@ -37602,6 +37592,7 @@ function getDocA() {
|
|
|
37602
37592
|
let docAVersion = docAVersionValue.substring(1);
|
|
37603
37593
|
let docAPage = Number($("#docAPage").val());
|
|
37604
37594
|
let docAVersionFile = context.fileVersionList.find(item => item.name == docAVersion);
|
|
37595
|
+
docAFileVersionList = context.fileVersionList;
|
|
37605
37596
|
let docA = {
|
|
37606
37597
|
name: fileName,
|
|
37607
37598
|
version: docAVersionValue,
|
|
@@ -37621,6 +37612,7 @@ function getDocB() {
|
|
|
37621
37612
|
let docBVersion = docBVersionValue.substring(1);
|
|
37622
37613
|
let docBPage = Number($("#docBPage").val());
|
|
37623
37614
|
let docBVersionFile = context.fileVersionList.find(item => item.name == docBVersion);
|
|
37615
|
+
docBFileVersionList = context.fileVersionList;
|
|
37624
37616
|
let docB = {
|
|
37625
37617
|
name: fileName,
|
|
37626
37618
|
version: docBVersionValue,
|
|
@@ -37758,14 +37750,14 @@ function isComparedDocumentCurrentOpened(url) {
|
|
|
37758
37750
|
|
|
37759
37751
|
function bindCompareDlgDcoAVersionChange() {
|
|
37760
37752
|
$('#docAVersion').on('change', function () {
|
|
37761
|
-
|
|
37753
|
+
refreshCompareObjListDocA();
|
|
37762
37754
|
loadDocAObj(compareObjList.docA.url);
|
|
37763
37755
|
});
|
|
37764
37756
|
}
|
|
37765
37757
|
|
|
37766
37758
|
function bindCompareDlgDcoBVersionChange() {
|
|
37767
37759
|
$('#docBVersion').on('change', function () {
|
|
37768
|
-
|
|
37760
|
+
refreshCompareObjListDocB();
|
|
37769
37761
|
loadDocBObj(compareObjList.docB.url);
|
|
37770
37762
|
});
|
|
37771
37763
|
}
|
|
@@ -37787,7 +37779,7 @@ function bindCompareDlgDcoAPageChange() {
|
|
|
37787
37779
|
} else {
|
|
37788
37780
|
enableAllpagesInOtherDropDown($('#docBPage'));
|
|
37789
37781
|
}
|
|
37790
|
-
compareObjList.docA =
|
|
37782
|
+
compareObjList.docA.page = Number($('#docAPage').val());
|
|
37791
37783
|
reloadCompareThumb(pdfDocObjA, thumbContainer, Number($(this).val()));
|
|
37792
37784
|
});
|
|
37793
37785
|
}
|
|
@@ -37800,7 +37792,7 @@ function bindCompareDlgDcoBPageChange() {
|
|
|
37800
37792
|
} else {
|
|
37801
37793
|
enableAllpagesInOtherDropDown($('#docAPage'));
|
|
37802
37794
|
}
|
|
37803
|
-
compareObjList.docB =
|
|
37795
|
+
compareObjList.docB.page = Number($('#docBPage').val());
|
|
37804
37796
|
reloadCompareThumb(pdfDocObjB, thumbContainer, Number($(this).val()));
|
|
37805
37797
|
});
|
|
37806
37798
|
}
|
|
@@ -38667,13 +38659,15 @@ function initItemChangedEventListener() {
|
|
|
38667
38659
|
window.addEventListener(EVENT_ITEM_CHANGED, onItemChanged);
|
|
38668
38660
|
}
|
|
38669
38661
|
|
|
38670
|
-
function onItemChanged() {
|
|
38671
|
-
|
|
38672
|
-
|
|
38673
|
-
|
|
38674
|
-
|
|
38675
|
-
|
|
38676
|
-
|
|
38662
|
+
function onItemChanged(e) {
|
|
38663
|
+
if (!isEventItemSelectDialog(e)) {
|
|
38664
|
+
const width = $('.vitro-issue-detail').width();
|
|
38665
|
+
if (width && $('.vitro-issue-detail').is(':visible')) {
|
|
38666
|
+
setContainerInset(width);
|
|
38667
|
+
}
|
|
38668
|
+
if (!$('.vitro-issue-detail').resizable('instance')) {
|
|
38669
|
+
initResizable($('.vitro-issue-detail'));
|
|
38670
|
+
}
|
|
38677
38671
|
}
|
|
38678
38672
|
}
|
|
38679
38673
|
|
|
@@ -38774,7 +38768,961 @@ function bindOnSidebarToggle() {
|
|
|
38774
38768
|
function isScaleModeRelative() {
|
|
38775
38769
|
const currentScaleMode = PDFViewerApplication.pdfViewer._currentScaleValue;
|
|
38776
38770
|
return currentScaleMode == 'page-width' || currentScaleMode == 'page-fit' || currentScaleMode == 'auto';
|
|
38771
|
+
}
|
|
38772
|
+
|
|
38773
|
+
function initButtonSelectFileDocA() {
|
|
38774
|
+
const btn = $('<a id="btnSelectFileDocA">' + context.selectFileBtnText + '</a>');
|
|
38775
|
+
btn.on('click', onClickButtonSelectFileDocA);
|
|
38776
|
+
$('.compare-dlg_doc-a_file-select').append(btn);
|
|
38777
|
+
}
|
|
38778
|
+
|
|
38779
|
+
async function onClickButtonSelectFileDocA(e) {
|
|
38780
|
+
e.preventDefault();
|
|
38781
|
+
e.stopPropagation();
|
|
38782
|
+
const idList = await context.getItemIdList();
|
|
38783
|
+
const id = idList?.length ? idList[0] : false;
|
|
38784
|
+
onSelectFileDocA(id);
|
|
38785
|
+
}
|
|
38786
|
+
|
|
38787
|
+
async function onSelectFileDocA(id) {
|
|
38788
|
+
if (isSelectedFileChanged(id, getDocFileIdFromUrl(compareObjList.docA.url))) {
|
|
38789
|
+
const docObj = await getDocObj(id, $('#docAVersionList'), $("#docAVersion"), $("#docAPage"), $('div.compare-dlg_doc-a_name'), DOC_A);
|
|
38790
|
+
if (docObj) {
|
|
38791
|
+
compareObjList.docA = docObj;
|
|
38792
|
+
loadDocAObj(compareObjList.docA.url);
|
|
38793
|
+
}
|
|
38794
|
+
}
|
|
38795
|
+
}
|
|
38796
|
+
|
|
38797
|
+
function isSelectedFileChanged(id, compareObjListDocId) {
|
|
38798
|
+
return id && (context.file.id !== id || (context.file.id === id && id !== compareObjListDocId));
|
|
38799
|
+
}
|
|
38800
|
+
|
|
38801
|
+
async function getDocObj(id, fileVersionListElm, docVersionElm, docPageElm, fileNameElm, docType) {
|
|
38802
|
+
const file = await context.itemService.get(id);
|
|
38803
|
+
const fileName = file.fieldValueMap.name;
|
|
38804
|
+
|
|
38805
|
+
if (isValidDocumentFormat(fileName)) {
|
|
38806
|
+
const fileId = file.id;
|
|
38807
|
+
const versionList = await context.fileService.get(id);
|
|
38808
|
+
const fileVersionList = getFileVersionList(versionList);
|
|
38809
|
+
setDocFileVersionList(docType, fileVersionList);
|
|
38810
|
+
const fileVersion = file.fieldValueMap.version.fieldValueMap.name;
|
|
38811
|
+
setDlgDocFileName(fileNameElm, fileName);
|
|
38812
|
+
refreshVersionList(fileVersionListElm, fileVersionList);
|
|
38813
|
+
const docVersionValue = 'v' + fileVersion;
|
|
38814
|
+
docVersionElm.val(docVersionValue);
|
|
38815
|
+
docPageElm.val(1);
|
|
38816
|
+
const docVersionFile = fileVersionList.find(item => item.name == fileVersion);
|
|
38817
|
+
|
|
38818
|
+
const doc = {
|
|
38819
|
+
name: fileName,
|
|
38820
|
+
version: docVersionValue,
|
|
38821
|
+
page: 1,
|
|
38822
|
+
uploadBy: docVersionFile.userName,
|
|
38823
|
+
uploadDate: docVersionFile.date,
|
|
38824
|
+
url: `/api/file/getByItemId/${fileId}/${fileVersion}`
|
|
38825
|
+
};
|
|
38826
|
+
|
|
38827
|
+
return doc;
|
|
38828
|
+
}
|
|
38829
|
+
|
|
38830
|
+
return false;
|
|
38831
|
+
}
|
|
38832
|
+
|
|
38833
|
+
function setDocFileVersionList(docType, fileVersionList) {
|
|
38834
|
+
if (docType === DOC_A) {
|
|
38835
|
+
docAFileVersionList = fileVersionList;
|
|
38836
|
+
} else {
|
|
38837
|
+
docBFileVersionList = fileVersionList;
|
|
38838
|
+
}
|
|
38839
|
+
}
|
|
38840
|
+
|
|
38841
|
+
function refreshVersionList(fileVersionListElm, fileVersionList) {
|
|
38842
|
+
fileVersionListElm.html(null);
|
|
38843
|
+
$.each(fileVersionList, function (i, item) {
|
|
38844
|
+
const value = 'v' + item.name;
|
|
38845
|
+
fileVersionListElm.append($('<li>', {
|
|
38846
|
+
value: value,
|
|
38847
|
+
text: value,
|
|
38848
|
+
}));
|
|
38849
|
+
});
|
|
38850
|
+
}
|
|
38851
|
+
|
|
38852
|
+
function getFileVersionList(versionList) {
|
|
38853
|
+
const list = versionList?.map(version => {
|
|
38854
|
+
return {
|
|
38855
|
+
id: version.id,
|
|
38856
|
+
name: version.fieldValueMap.name,
|
|
38857
|
+
userName: version.insertUserName,
|
|
38858
|
+
date: context.getDateText(version.insertDate)
|
|
38859
|
+
};
|
|
38860
|
+
});
|
|
38861
|
+
|
|
38862
|
+
return list;
|
|
38863
|
+
};
|
|
38864
|
+
|
|
38865
|
+
function setDlgDocFileName(fileNameElm, fileName) {
|
|
38866
|
+
fileNameElm.text(fileName);
|
|
38867
|
+
}
|
|
38868
|
+
|
|
38869
|
+
function initButtonSelectFileDocB() {
|
|
38870
|
+
const btn = $('<a id="btnSelectFileDocB">' + context.selectFileBtnText + '</a>');
|
|
38871
|
+
btn.on('click', onClickButtonSelectFileDocB);
|
|
38872
|
+
$('.compare-dlg_doc-b_file-select').append(btn);
|
|
38873
|
+
}
|
|
38874
|
+
|
|
38875
|
+
async function onClickButtonSelectFileDocB(e) {
|
|
38876
|
+
e.preventDefault();
|
|
38877
|
+
e.stopPropagation();
|
|
38878
|
+
const idList = await context.getItemIdList();
|
|
38879
|
+
const id = idList?.length ? idList[0] : false;
|
|
38880
|
+
onSelectFileDocB(id);
|
|
38881
|
+
}
|
|
38882
|
+
|
|
38883
|
+
async function onSelectFileDocB(id) {
|
|
38884
|
+
if (isSelectedFileChanged(id, getDocFileIdFromUrl(compareObjList.docB.url))) {
|
|
38885
|
+
const docObj = await getDocObj(id, $('#docBVersionList'), $("#docBVersion"), $("#docBPage"), $('div.compare-dlg_doc-b_name'), DOC_B);
|
|
38886
|
+
if (docObj) {
|
|
38887
|
+
compareObjList.docB = docObj;
|
|
38888
|
+
loadDocBObj(compareObjList.docB.url);
|
|
38889
|
+
}
|
|
38890
|
+
|
|
38891
|
+
}
|
|
38892
|
+
}
|
|
38893
|
+
|
|
38894
|
+
function getDocFileIdFromUrl(url) {
|
|
38895
|
+
const urlArr = url.split('/');
|
|
38896
|
+
return itemId = urlArr[urlArr.length - 2];
|
|
38897
|
+
}
|
|
38898
|
+
|
|
38899
|
+
function refreshCompareObjListDocA() {
|
|
38900
|
+
refreshCompareObjListDoc(DOC_A);
|
|
38901
|
+
};
|
|
38902
|
+
|
|
38903
|
+
function refreshCompareObjListDocB() {
|
|
38904
|
+
refreshCompareObjListDoc(DOC_B);
|
|
38905
|
+
};
|
|
38906
|
+
|
|
38907
|
+
function refreshCompareObjListDoc(docType) {
|
|
38908
|
+
const docVersionValue = $("#" + docType + "Version").val();
|
|
38909
|
+
const docVersion = docVersionValue.substring(1);
|
|
38910
|
+
const docPage = Number($("#" + docType + "Page").val());
|
|
38911
|
+
let docVersionFile;
|
|
38912
|
+
if (docType === DOC_A) {
|
|
38913
|
+
docVersionFile = docAFileVersionList.find(item => item.name == docVersion);
|
|
38914
|
+
} else {
|
|
38915
|
+
docVersionFile = docBFileVersionList.find(item => item.name == docVersion);
|
|
38916
|
+
}
|
|
38917
|
+
compareObjList[docType].page = docPage;
|
|
38918
|
+
compareObjList[docType].version = docVersionValue;
|
|
38919
|
+
compareObjList[docType].uploadBy = docVersionFile.userName;
|
|
38920
|
+
compareObjList[docType].uploadDate = docVersionFile.date;
|
|
38921
|
+
compareObjList[docType].url = getDocVersionUrl(compareObjList[docType].url, docVersion);
|
|
38922
|
+
}
|
|
38923
|
+
|
|
38924
|
+
function getDocVersionUrl(url, version) {
|
|
38925
|
+
const lastSlashIndex = url.lastIndexOf('/');
|
|
38926
|
+
if (lastSlashIndex === -1) {
|
|
38927
|
+
return url;
|
|
38928
|
+
}
|
|
38929
|
+
const partBeforeLastSlash = url.slice(0, lastSlashIndex + 1);
|
|
38930
|
+
return partBeforeLastSlash + version;
|
|
38931
|
+
}
|
|
38932
|
+
|
|
38933
|
+
function resetDocFileVersionList() {
|
|
38934
|
+
docAFileVersionList = currentDocFileVersionList;
|
|
38935
|
+
docBFileVersionList = currentDocFileVersionList;
|
|
38936
|
+
}
|
|
38937
|
+
|
|
38938
|
+
function resetDocPage() {
|
|
38939
|
+
const currentPage = getCurrentPage();
|
|
38940
|
+
$("#docAPage").val(currentPage);
|
|
38941
|
+
$("#docBPage").val(currentPage);
|
|
38942
|
+
}
|
|
38943
|
+
|
|
38944
|
+
function initDocVersion() {
|
|
38945
|
+
const loadedVersion = getInitVersionDocA();
|
|
38946
|
+
const versionDocB = getInitVersionDocB(loadedVersion);
|
|
38947
|
+
$('#docAVersion').val(loadedVersion);
|
|
38948
|
+
$('#docBVersion').val(versionDocB);
|
|
38949
|
+
}
|
|
38950
|
+
|
|
38951
|
+
function getInitVersionDocA() {
|
|
38952
|
+
const loadedVersionId = getLoadedVersionId();
|
|
38953
|
+
const version = context.fileVersionList.find(item => item.id == loadedVersionId);
|
|
38954
|
+
const loadedVersion = `v${version.name}`;
|
|
38955
|
+
return loadedVersion;
|
|
38956
|
+
}
|
|
38957
|
+
|
|
38958
|
+
function getInitVersionDocB(loadedVersion) {
|
|
38959
|
+
const loadedVersionId = getLoadedVersionId();
|
|
38960
|
+
if (loadedVersionId != context.currentVersionId) {
|
|
38961
|
+
const lastVersion = context.fileVersionList.find(item => item.id == context.currentVersionId);
|
|
38962
|
+
const lastVersionLabel = `v${lastVersion.name}`;
|
|
38963
|
+
return lastVersionLabel;
|
|
38964
|
+
} else {
|
|
38965
|
+
if (context.fileVersionList.length > 1) {
|
|
38966
|
+
const previousVersion = context.fileVersionList[1];
|
|
38967
|
+
const previousVersionLabel = `v${previousVersion.name}`;
|
|
38968
|
+
return previousVersionLabel;
|
|
38969
|
+
} else {
|
|
38970
|
+
return loadedVersion;
|
|
38971
|
+
}
|
|
38972
|
+
}
|
|
38973
|
+
}
|
|
38974
|
+
|
|
38975
|
+
function isValidDocumentFormat(filename) {
|
|
38976
|
+
const lowercasedFilename = filename.toLowerCase();
|
|
38977
|
+
return lowercasedFilename.endsWith(FILE_EXTENSION_PDF);
|
|
38978
|
+
}
|
|
38979
|
+
|
|
38980
|
+
function isEventItemSelectDialog(e) {
|
|
38981
|
+
return e?.detail?.eventScopeId?.startsWith(ITEM_SELECT_DIALOG);
|
|
38777
38982
|
}
|
|
38983
|
+
const MARKUP_RESIZER_ID_PREFIX = 'markupResizer';
|
|
38984
|
+
const CSS_CLASS_MARKUP_RESIZER = 'vitro-markup-resizer';
|
|
38985
|
+
const CSS_CLASS_PDF_NOTE = 'pdf-note';
|
|
38986
|
+
const CSS_CLASS_PAGE = 'page';
|
|
38987
|
+
const MARKUP_EDIT_OUTLINE_ID = 'markupEditOutline';
|
|
38988
|
+
let isMarkupEdit;
|
|
38989
|
+
let isMarkupMove;
|
|
38990
|
+
let isMarkupResize;
|
|
38991
|
+
let markupResizeCoordinates = {}; // {start: {mouseX, mouseY}, end: {mouseX, mouseY}, type: tl|tc|tr|...}
|
|
38992
|
+
let markupMoveCoordinates = {}; // {start: {mouseX, mouseY}, end: {mouseX, mouseY}}
|
|
38993
|
+
let markupUnderEditingSettings = {};
|
|
38994
|
+
let markupEditOutlineSettings = {};
|
|
38995
|
+
|
|
38996
|
+
|
|
38997
|
+
function onMarkupEditStart(e) {
|
|
38998
|
+
setPdfViewerCursorToolMode();
|
|
38999
|
+
if (isMarkupEdit) {
|
|
39000
|
+
endMarkupEdit();
|
|
39001
|
+
}
|
|
39002
|
+
isMarkupEdit = true;
|
|
39003
|
+
createMarkupEditOutline(e);
|
|
39004
|
+
bindMouseUpEventHandler();
|
|
39005
|
+
bindOnMarkupEditEndHandler();
|
|
39006
|
+
}
|
|
39007
|
+
|
|
39008
|
+
function onMarkupEditOutlineMouseDown(e) {
|
|
39009
|
+
e.stopPropagation();
|
|
39010
|
+
e.preventDefault();
|
|
39011
|
+
|
|
39012
|
+
isMarkupMove = true;
|
|
39013
|
+
markupMoveCoordinates.start = { x: e.clientX, y: e.clientY };
|
|
39014
|
+
bindOnMouseMoveEventHandler();
|
|
39015
|
+
}
|
|
39016
|
+
|
|
39017
|
+
function onMarkupEditOutlineMouseUp(e) {
|
|
39018
|
+
markupMoveCoordinates.end = { x: e.clientX, y: e.clientY };
|
|
39019
|
+
unbindOnMouseMoveEventHandler()
|
|
39020
|
+
onMarkupMoveEnd();
|
|
39021
|
+
}
|
|
39022
|
+
|
|
39023
|
+
function onMouseMove(e) {
|
|
39024
|
+
if (isMarkupEdit && isMarkupMove) {
|
|
39025
|
+
onMarkupMove(e.clientX, e.clientY);
|
|
39026
|
+
}
|
|
39027
|
+
if (isMarkupEdit && isMarkupResize) {
|
|
39028
|
+
onMarkupResize(e.clientX, e.clientY);
|
|
39029
|
+
}
|
|
39030
|
+
}
|
|
39031
|
+
|
|
39032
|
+
function onMarkupMove(mouseX, mouseY) {
|
|
39033
|
+
const x = markupEditOutlineSettings.position.x - markupMoveCoordinates.start.x + mouseX;
|
|
39034
|
+
const y = markupEditOutlineSettings.position.y - markupMoveCoordinates.start.y + mouseY;
|
|
39035
|
+
setMarkupOutlinePosition($('#' + MARKUP_EDIT_OUTLINE_ID), x, y);
|
|
39036
|
+
}
|
|
39037
|
+
|
|
39038
|
+
function onMarkupMoveEnd() {
|
|
39039
|
+
isMarkupMove = false;
|
|
39040
|
+
markupMoveCoordinates = {};
|
|
39041
|
+
setMarkupEditOutlinePositionNew();
|
|
39042
|
+
if (markupEditOutlineSettings.isSimple) {
|
|
39043
|
+
refreshMarkupSimple();
|
|
39044
|
+
setMarkupSimpleUnderEditingSettingsNew();
|
|
39045
|
+
} else {
|
|
39046
|
+
setMarkupUnderEditingSettingsNew(false);
|
|
39047
|
+
refreshMarkup();
|
|
39048
|
+
}
|
|
39049
|
+
updateMarkupInContextIssueList();
|
|
39050
|
+
}
|
|
39051
|
+
|
|
39052
|
+
function refreshMarkupSimple() {
|
|
39053
|
+
let labelPosition = { ...markupEditOutlineSettings.position };
|
|
39054
|
+
const rotation = getPdfPagesRotation();
|
|
39055
|
+
if (rotation == 90) {
|
|
39056
|
+
labelPosition.x = labelPosition.x + $('#markupEditOutline').height() + 1;
|
|
39057
|
+
}
|
|
39058
|
+
if (rotation == 180) {
|
|
39059
|
+
labelPosition.x = labelPosition.x + $('#markupEditOutline').width() + 1;
|
|
39060
|
+
labelPosition.y = labelPosition.y + $('#markupEditOutline').height() + 1;
|
|
39061
|
+
}
|
|
39062
|
+
if (rotation == 270) {
|
|
39063
|
+
labelPosition.y = labelPosition.y + $('#markupEditOutline').width() + 1;
|
|
39064
|
+
}
|
|
39065
|
+
$('.pdf-note#' + markupUnderEditingSettings.issueId).css('left', labelPosition.x)
|
|
39066
|
+
.css('top', labelPosition.y);
|
|
39067
|
+
}
|
|
39068
|
+
|
|
39069
|
+
function refreshMarkup() {
|
|
39070
|
+
const markupSvgData = { ...markupUnderEditingSettings.markup.svg };
|
|
39071
|
+
if (!$('#' + markupSvgData.id)?.length) {
|
|
39072
|
+
markupSvgData.id = markupUnderEditingSettings.issueId;
|
|
39073
|
+
}
|
|
39074
|
+
loadSvgShape(markupSvgData);
|
|
39075
|
+
refreshMarkupLabel(markupSvgData);
|
|
39076
|
+
}
|
|
39077
|
+
|
|
39078
|
+
function refreshMarkupLabel(markupSvgData) {
|
|
39079
|
+
const rotation = getPdfPagesRotation();
|
|
39080
|
+
const scale = getPdfCanvasScale();
|
|
39081
|
+
const labelPosition = getMarkupLabelPositionBySvgType(markupSvgData, markupUnderEditingSettings.markup.position);
|
|
39082
|
+
const labelPositionScaled = { x: labelPosition.x * scale, y: labelPosition.y * scale };
|
|
39083
|
+
let labelPositionWithRotation = { ...labelPositionScaled };
|
|
39084
|
+
if (rotation > 0) {
|
|
39085
|
+
const data = {
|
|
39086
|
+
position: { ...labelPositionScaled },
|
|
39087
|
+
pageNr: markupUnderEditingSettings.markup.pageNr
|
|
39088
|
+
};
|
|
39089
|
+
labelPositionWithRotation = getNoteLabelPositionWithRotation(data, rotation);
|
|
39090
|
+
}
|
|
39091
|
+
const markupLabelElm = $('#' + markupUnderEditingSettings.issueId);
|
|
39092
|
+
markupLabelElm.css('left', labelPositionWithRotation.x).css('top', labelPositionWithRotation.y);
|
|
39093
|
+
}
|
|
39094
|
+
|
|
39095
|
+
function updateMarkupInContextIssueList() {
|
|
39096
|
+
const issueIndex = context.issueList.findIndex(item => item.id === markupUnderEditingSettings.issueId);
|
|
39097
|
+
context.issueList[issueIndex].markup = JSON.stringify(markupUnderEditingSettings.markup);
|
|
39098
|
+
}
|
|
39099
|
+
|
|
39100
|
+
function setMarkupEditOutlinePositionNew() {
|
|
39101
|
+
const markupEditOutlinePosition = $('#' + MARKUP_EDIT_OUTLINE_ID).position();
|
|
39102
|
+
markupEditOutlineSettings.position.x = markupEditOutlinePosition?.left;
|
|
39103
|
+
markupEditOutlineSettings.position.y = markupEditOutlinePosition?.top;
|
|
39104
|
+
}
|
|
39105
|
+
|
|
39106
|
+
function getMarkupEditOutlineSettingsNormalized() {
|
|
39107
|
+
const svgsketchElm = $('#svgsketch-' + markupUnderEditingSettings.markup.pageNr);
|
|
39108
|
+
const svgsketchWidth = svgsketchElm.width();
|
|
39109
|
+
const svgsketchHeight = svgsketchElm.height();
|
|
39110
|
+
const scale = getPdfCanvasScale();
|
|
39111
|
+
const rotation = getPdfPagesRotation();
|
|
39112
|
+
|
|
39113
|
+
if (rotation === 90) {
|
|
39114
|
+
return getMarkupEditOutlineSettingsNormalizedRotation90Deg(scale, svgsketchWidth);
|
|
39115
|
+
} else if (rotation === 180) {
|
|
39116
|
+
return getMarkupEditOutlineSettingsNormalizedRotation180Deg(scale, svgsketchWidth, svgsketchHeight);
|
|
39117
|
+
} else if (rotation === 270) {
|
|
39118
|
+
return getMarkupEditOutlineSettingsNormalizedRotation270Deg(scale, svgsketchHeight);
|
|
39119
|
+
} else {
|
|
39120
|
+
return getMarkupEditOutlineSettingsNormalizedRotation0Deg(scale);
|
|
39121
|
+
}
|
|
39122
|
+
}
|
|
39123
|
+
|
|
39124
|
+
function getMarkupEditOutlineSettingsNormalizedRotation0Deg(scale) {
|
|
39125
|
+
const settings = {
|
|
39126
|
+
position: {
|
|
39127
|
+
x: markupEditOutlineSettings.position.x / scale,
|
|
39128
|
+
y: markupEditOutlineSettings.position.y / scale
|
|
39129
|
+
},
|
|
39130
|
+
width: markupEditOutlineSettings.width / scale,
|
|
39131
|
+
height: markupEditOutlineSettings.height / scale
|
|
39132
|
+
};
|
|
39133
|
+
return settings;
|
|
39134
|
+
}
|
|
39135
|
+
|
|
39136
|
+
function getMarkupEditOutlineSettingsNormalizedRotation90Deg(scale, svgsketchWidth) {
|
|
39137
|
+
const settings = {
|
|
39138
|
+
position: {
|
|
39139
|
+
x: markupEditOutlineSettings.position.y / scale,
|
|
39140
|
+
y: (svgsketchWidth - markupEditOutlineSettings.width - markupEditOutlineSettings.position.x) / scale
|
|
39141
|
+
},
|
|
39142
|
+
width: markupEditOutlineSettings.height / scale,
|
|
39143
|
+
height: markupEditOutlineSettings.width / scale
|
|
39144
|
+
};
|
|
39145
|
+
return settings;
|
|
39146
|
+
}
|
|
39147
|
+
|
|
39148
|
+
function getMarkupEditOutlineSettingsNormalizedRotation180Deg(scale, svgsketchWidth, svgsketchHeight) {
|
|
39149
|
+
const settings = {
|
|
39150
|
+
position: {
|
|
39151
|
+
x: (svgsketchWidth - markupEditOutlineSettings.width - markupEditOutlineSettings.position.x) / scale,
|
|
39152
|
+
y: (svgsketchHeight - markupEditOutlineSettings.height - markupEditOutlineSettings.position.y) / scale
|
|
39153
|
+
},
|
|
39154
|
+
width: markupEditOutlineSettings.width / scale,
|
|
39155
|
+
height: markupEditOutlineSettings.height / scale
|
|
39156
|
+
};
|
|
39157
|
+
return settings;
|
|
39158
|
+
}
|
|
39159
|
+
|
|
39160
|
+
function getMarkupEditOutlineSettingsNormalizedRotation270Deg(scale, svgsketchHeight) {
|
|
39161
|
+
const settings = {
|
|
39162
|
+
position: {
|
|
39163
|
+
x: (svgsketchHeight - markupEditOutlineSettings.height - markupEditOutlineSettings.position.y) / scale,
|
|
39164
|
+
y: markupEditOutlineSettings.position.x / scale
|
|
39165
|
+
},
|
|
39166
|
+
width: markupEditOutlineSettings.height / scale,
|
|
39167
|
+
height: markupEditOutlineSettings.width / scale
|
|
39168
|
+
};
|
|
39169
|
+
return settings;
|
|
39170
|
+
}
|
|
39171
|
+
|
|
39172
|
+
function getMarkupLabelPosition(svgData) {
|
|
39173
|
+
var topFix = 15;
|
|
39174
|
+
var leftFix = 20;
|
|
39175
|
+
|
|
39176
|
+
var relX = svgData.position.x - leftFix;
|
|
39177
|
+
var relY = svgData.position.y - topFix;
|
|
39178
|
+
|
|
39179
|
+
var position = {
|
|
39180
|
+
x: relX,
|
|
39181
|
+
y: relY
|
|
39182
|
+
};
|
|
39183
|
+
|
|
39184
|
+
return position;
|
|
39185
|
+
}
|
|
39186
|
+
|
|
39187
|
+
function getMarkupLabelPositionBySvgType(svgData, labelPosition) {
|
|
39188
|
+
let markupLabelPosition = { ...labelPosition };
|
|
39189
|
+
if (svgData.type == 'ellipse' || svgData.type == 'polygon') {
|
|
39190
|
+
markupLabelPosition.y = labelPosition.y + svgData.height / 2;
|
|
39191
|
+
} else if (svgData.type == 'line' || svgData.type == 'arrow' || svgData.type == 'msr_line') {
|
|
39192
|
+
if (svgData.direction == 'bltr') {
|
|
39193
|
+
markupLabelPosition.y = labelPosition.y + svgData.height;
|
|
39194
|
+
} else if (svgData.direction == 'trbl') {
|
|
39195
|
+
markupLabelPosition.x = labelPosition.x + svgData.width;
|
|
39196
|
+
} else if (svgData.direction == 'brtl') {
|
|
39197
|
+
markupLabelPosition.x = labelPosition.x + svgData.width;
|
|
39198
|
+
markupLabelPosition.y = labelPosition.y + svgData.height;
|
|
39199
|
+
}
|
|
39200
|
+
}
|
|
39201
|
+
return markupLabelPosition;
|
|
39202
|
+
}
|
|
39203
|
+
|
|
39204
|
+
function setMarkupUnderEditingSettingsNew(isSetSize) {
|
|
39205
|
+
const markupEditOutlineSettingsNormalized = getMarkupEditOutlineSettingsNormalized();
|
|
39206
|
+
if (isSetSize) {
|
|
39207
|
+
markupUnderEditingSettings.markup.svg.width = markupEditOutlineSettingsNormalized.width;
|
|
39208
|
+
markupUnderEditingSettings.markup.svg.height = markupEditOutlineSettingsNormalized.height;
|
|
39209
|
+
}
|
|
39210
|
+
markupUnderEditingSettings.markup.svg.position.x = markupEditOutlineSettingsNormalized.position.x;
|
|
39211
|
+
markupUnderEditingSettings.markup.svg.position.y = markupEditOutlineSettingsNormalized.position.y;
|
|
39212
|
+
const labelPosition = getMarkupLabelPosition(markupUnderEditingSettings.markup.svg);
|
|
39213
|
+
markupUnderEditingSettings.markup.position = labelPosition;
|
|
39214
|
+
}
|
|
39215
|
+
|
|
39216
|
+
function setMarkupSimpleUnderEditingSettingsNew() {
|
|
39217
|
+
let position = {};
|
|
39218
|
+
|
|
39219
|
+
const scale = getPdfCanvasScale();
|
|
39220
|
+
const rotation = getPdfPagesRotation();
|
|
39221
|
+
|
|
39222
|
+
const labelElm = $('#' + markupUnderEditingSettings.issueId);
|
|
39223
|
+
const labelPos = labelElm.position();
|
|
39224
|
+
const labelElmWidth = labelElm.outerWidth();
|
|
39225
|
+
const labelElmHeight = labelElm.outerHeight();
|
|
39226
|
+
const page = $('.' + CSS_CLASS_PAGE + '[data-page-number="' + markupUnderEditingSettings.markup.pageNr + '"]');
|
|
39227
|
+
const pageW = page.width();
|
|
39228
|
+
const pageH = page.height();
|
|
39229
|
+
|
|
39230
|
+
|
|
39231
|
+
if (rotation == 90) {
|
|
39232
|
+
position.x = labelPos.top / scale;
|
|
39233
|
+
position.y = pageW/scale - (labelPos.left / scale + labelElmHeight);
|
|
39234
|
+
} else if (rotation == 180) {
|
|
39235
|
+
position.x = pageW / scale - (labelPos.left / scale + labelElmWidth);
|
|
39236
|
+
position.y = pageH / scale - (labelPos.top / scale + labelElmHeight);
|
|
39237
|
+
} else if (rotation == 270) {
|
|
39238
|
+
position.x = pageH / scale - (labelPos.top / scale + labelElmWidth);
|
|
39239
|
+
position.y = labelPos.left / scale;
|
|
39240
|
+
} else {
|
|
39241
|
+
position.x = labelPos.left / scale;
|
|
39242
|
+
position.y = labelPos.top / scale;
|
|
39243
|
+
}
|
|
39244
|
+
|
|
39245
|
+
markupUnderEditingSettings.markup.position.x = position.x;
|
|
39246
|
+
markupUnderEditingSettings.markup.position.y = position.y;
|
|
39247
|
+
}
|
|
39248
|
+
|
|
39249
|
+
function onMarkupResizerMouseDown(e) {
|
|
39250
|
+
isMarkupMove = false;
|
|
39251
|
+
e.stopPropagation();
|
|
39252
|
+
e.preventDefault();
|
|
39253
|
+
|
|
39254
|
+
isMarkupResize = true;
|
|
39255
|
+
markupResizeCoordinates.start = { x: e.clientX, y: e.clientY };
|
|
39256
|
+
markupResizeCoordinates.type = getMarkupResizeType(e);
|
|
39257
|
+
bindOnMouseMoveEventHandler();
|
|
39258
|
+
}
|
|
39259
|
+
|
|
39260
|
+
function getMarkupResizeType(e) {
|
|
39261
|
+
return e?.target?.id?.replace(MARKUP_RESIZER_ID_PREFIX, '')?.toLowerCase();
|
|
39262
|
+
}
|
|
39263
|
+
|
|
39264
|
+
function bindOnMouseMoveEventHandler() {
|
|
39265
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
39266
|
+
}
|
|
39267
|
+
|
|
39268
|
+
function unbindOnMouseMoveEventHandler() {
|
|
39269
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
39270
|
+
}
|
|
39271
|
+
|
|
39272
|
+
function onMarkupResize(mouseX, mouseY) {
|
|
39273
|
+
let settings;
|
|
39274
|
+
const outlineElm = $('#' + MARKUP_EDIT_OUTLINE_ID);
|
|
39275
|
+
const outlineHeight = markupEditOutlineSettings.height;
|
|
39276
|
+
const outlineWidth = markupEditOutlineSettings.width;
|
|
39277
|
+
const deltaY = mouseY - markupResizeCoordinates.start.y;
|
|
39278
|
+
const deltaX = mouseX - markupResizeCoordinates.start.x;
|
|
39279
|
+
|
|
39280
|
+
if (markupResizeCoordinates.type === 'tl') {
|
|
39281
|
+
settings = getMarkupEditOutlineSettingsOnResizeTL(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY);
|
|
39282
|
+
}
|
|
39283
|
+
if (markupResizeCoordinates.type === 'tc') {
|
|
39284
|
+
settings = getMarkupEditOutlineSettingsOnResizeTC(outlineWidth, outlineHeight, mouseY, deltaY);
|
|
39285
|
+
}
|
|
39286
|
+
if (markupResizeCoordinates.type === 'tr') {
|
|
39287
|
+
settings = getMarkupEditOutlineSettingsOnResizeTR(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY);
|
|
39288
|
+
}
|
|
39289
|
+
if (markupResizeCoordinates.type === 'cl') {
|
|
39290
|
+
settings = getMarkupEditOutlineSettingsOnResizeCL(outlineWidth, outlineHeight, mouseX, deltaX);
|
|
39291
|
+
}
|
|
39292
|
+
if (markupResizeCoordinates.type === 'cr') {
|
|
39293
|
+
settings = getMarkupEditOutlineSettingsOnResizeCR(outlineWidth, outlineHeight, mouseX, deltaX);
|
|
39294
|
+
}
|
|
39295
|
+
if (markupResizeCoordinates.type === 'bl') {
|
|
39296
|
+
settings = getMarkupEditOutlineSettingsOnResizeBL(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY);
|
|
39297
|
+
}
|
|
39298
|
+
if (markupResizeCoordinates.type === 'bc') {
|
|
39299
|
+
settings = getMarkupEditOutlineSettingsOnResizeBC(outlineWidth, outlineHeight, mouseY, deltaY);
|
|
39300
|
+
}
|
|
39301
|
+
if (markupResizeCoordinates.type === 'br') {
|
|
39302
|
+
settings = getMarkupEditOutlineSettingsOnResizeBR(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY);
|
|
39303
|
+
}
|
|
39304
|
+
|
|
39305
|
+
if (settings) {
|
|
39306
|
+
setMarkupOutlinePosition(outlineElm, settings.position.x, settings.position.y);
|
|
39307
|
+
setMarkupOutlineSize(outlineElm, settings.width, settings.height);
|
|
39308
|
+
}
|
|
39309
|
+
}
|
|
39310
|
+
|
|
39311
|
+
function getMarkupEditOutlineSettingsOnResizeTL(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY) {
|
|
39312
|
+
const settings = {
|
|
39313
|
+
position: {
|
|
39314
|
+
x: (markupEditOutlineSettings.position.x + deltaX) <= (markupEditOutlineSettings.position.x + outlineWidth) ? (markupEditOutlineSettings.position.x + deltaX) : (markupEditOutlineSettings.position.x + outlineWidth),
|
|
39315
|
+
y: (markupEditOutlineSettings.position.y + deltaY) <= (markupEditOutlineSettings.position.y + outlineHeight) ? (markupEditOutlineSettings.position.y + deltaY) : (markupEditOutlineSettings.position.y + outlineHeight)
|
|
39316
|
+
},
|
|
39317
|
+
width: Math.abs(outlineWidth - deltaX),
|
|
39318
|
+
height: Math.abs(outlineHeight - deltaY)
|
|
39319
|
+
};
|
|
39320
|
+
return settings;
|
|
39321
|
+
}
|
|
39322
|
+
|
|
39323
|
+
function getMarkupEditOutlineSettingsOnResizeTC(outlineWidth, outlineHeight, mouseY, deltaY) {
|
|
39324
|
+
const settings = {
|
|
39325
|
+
position: {
|
|
39326
|
+
x: markupEditOutlineSettings.position.x,
|
|
39327
|
+
y: (markupEditOutlineSettings.position.y + deltaY) <= (markupEditOutlineSettings.position.y + outlineHeight) ? (markupEditOutlineSettings.position.y + deltaY) : (markupEditOutlineSettings.position.y + outlineHeight)
|
|
39328
|
+
},
|
|
39329
|
+
width: outlineWidth,
|
|
39330
|
+
height: Math.abs(outlineHeight - deltaY)
|
|
39331
|
+
};
|
|
39332
|
+
return settings;
|
|
39333
|
+
}
|
|
39334
|
+
|
|
39335
|
+
function getMarkupEditOutlineSettingsOnResizeTR(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY) {
|
|
39336
|
+
const settings = {
|
|
39337
|
+
position: {
|
|
39338
|
+
x: (deltaX < 0 && Math.abs(deltaX) > outlineWidth) ? (markupEditOutlineSettings.position.x - Math.abs(deltaX) + outlineWidth) : markupEditOutlineSettings.position.x,
|
|
39339
|
+
y: (markupEditOutlineSettings.position.y + deltaY) <= (markupEditOutlineSettings.position.y + outlineHeight) ? (markupEditOutlineSettings.position.y + deltaY) : (markupEditOutlineSettings.position.y + outlineHeight)
|
|
39340
|
+
},
|
|
39341
|
+
width: Math.abs(outlineWidth + deltaX),
|
|
39342
|
+
height: Math.abs(outlineHeight - deltaY)
|
|
39343
|
+
};
|
|
39344
|
+
return settings;
|
|
39345
|
+
}
|
|
39346
|
+
|
|
39347
|
+
function getMarkupEditOutlineSettingsOnResizeCL(outlineWidth, outlineHeight, mouseX, deltaX) {
|
|
39348
|
+
const settings = {
|
|
39349
|
+
position: {
|
|
39350
|
+
x: (markupEditOutlineSettings.position.x + deltaX) <= (markupEditOutlineSettings.position.x + outlineWidth) ? (markupEditOutlineSettings.position.x + deltaX) : (markupEditOutlineSettings.position.x + outlineWidth),
|
|
39351
|
+
y: markupEditOutlineSettings.position.y,
|
|
39352
|
+
},
|
|
39353
|
+
width: Math.abs(outlineWidth - deltaX),
|
|
39354
|
+
height: outlineHeight
|
|
39355
|
+
};
|
|
39356
|
+
return settings;
|
|
39357
|
+
}
|
|
39358
|
+
|
|
39359
|
+
function getMarkupEditOutlineSettingsOnResizeCR(outlineWidth, outlineHeight, mouseX, deltaX) {
|
|
39360
|
+
const settings = {
|
|
39361
|
+
position: {
|
|
39362
|
+
x: (deltaX < 0 && Math.abs(deltaX) > outlineWidth) ? (markupEditOutlineSettings.position.x - Math.abs(deltaX) + outlineWidth) : markupEditOutlineSettings.position.x,
|
|
39363
|
+
y: markupEditOutlineSettings.position.y,
|
|
39364
|
+
},
|
|
39365
|
+
width: Math.abs(outlineWidth + deltaX),
|
|
39366
|
+
height: outlineHeight
|
|
39367
|
+
};
|
|
39368
|
+
return settings;
|
|
39369
|
+
}
|
|
39370
|
+
|
|
39371
|
+
function getMarkupEditOutlineSettingsOnResizeBL(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY) {
|
|
39372
|
+
const settings = {
|
|
39373
|
+
position: {
|
|
39374
|
+
x: (markupEditOutlineSettings.position.x + deltaX) <= (markupEditOutlineSettings.position.x + outlineWidth) ? (markupEditOutlineSettings.position.x + deltaX) : (markupEditOutlineSettings.position.x + outlineWidth),
|
|
39375
|
+
y: (deltaY < 0 && Math.abs(deltaY) > outlineHeight) ? (markupEditOutlineSettings.position.y - Math.abs(deltaY) + outlineHeight) : markupEditOutlineSettings.position.y
|
|
39376
|
+
},
|
|
39377
|
+
width: Math.abs(outlineWidth - deltaX),
|
|
39378
|
+
height: Math.abs(outlineHeight + deltaY)
|
|
39379
|
+
};
|
|
39380
|
+
return settings;
|
|
39381
|
+
}
|
|
39382
|
+
|
|
39383
|
+
function getMarkupEditOutlineSettingsOnResizeBC(outlineWidth, outlineHeight, mouseY, deltaY) {
|
|
39384
|
+
const settings = {
|
|
39385
|
+
position: {
|
|
39386
|
+
x: markupEditOutlineSettings.position.x,
|
|
39387
|
+
y: (deltaY < 0 && Math.abs(deltaY) > outlineHeight) ? (markupEditOutlineSettings.position.y - Math.abs(deltaY) + outlineHeight) : markupEditOutlineSettings.position.y
|
|
39388
|
+
},
|
|
39389
|
+
width: outlineWidth,
|
|
39390
|
+
height: Math.abs(outlineHeight + deltaY)
|
|
39391
|
+
};
|
|
39392
|
+
return settings;
|
|
39393
|
+
}
|
|
39394
|
+
|
|
39395
|
+
function getMarkupEditOutlineSettingsOnResizeBR(outlineWidth, outlineHeight, mouseX, mouseY, deltaX, deltaY) {
|
|
39396
|
+
const settings = {
|
|
39397
|
+
position: {
|
|
39398
|
+
x: (deltaX < 0 && Math.abs(deltaX) > outlineWidth) ? (markupEditOutlineSettings.position.x - Math.abs(deltaX) + outlineWidth) : markupEditOutlineSettings.position.x,
|
|
39399
|
+
y: (deltaY < 0 && Math.abs(deltaY) > outlineHeight) ? (markupEditOutlineSettings.position.y - Math.abs(deltaY) + outlineHeight) : markupEditOutlineSettings.position.y
|
|
39400
|
+
},
|
|
39401
|
+
width: Math.abs(outlineWidth + deltaX),
|
|
39402
|
+
height: Math.abs(outlineHeight + deltaY)
|
|
39403
|
+
};
|
|
39404
|
+
return settings;
|
|
39405
|
+
}
|
|
39406
|
+
|
|
39407
|
+
function onMarkupResizerMouseUp(e) {
|
|
39408
|
+
markupResizeCoordinates.end = { x: e.clientX, y: e.clientY };
|
|
39409
|
+
unbindOnMouseMoveEventHandler();
|
|
39410
|
+
onMarkupResizeEnd();
|
|
39411
|
+
}
|
|
39412
|
+
|
|
39413
|
+
function onMarkupResizeEnd() {
|
|
39414
|
+
isMarkupResize = false;
|
|
39415
|
+
markupResizeCoordinates = {};
|
|
39416
|
+
setMarkupEditOutlineSettingsNew();
|
|
39417
|
+
setMarkupUnderEditingSettingsNew(true);
|
|
39418
|
+
updateMarkupInContextIssueList();
|
|
39419
|
+
refreshMarkup();
|
|
39420
|
+
}
|
|
39421
|
+
|
|
39422
|
+
function setMarkupEditOutlineSettingsNew() {
|
|
39423
|
+
const markupEditOutlineElm = $('#' + MARKUP_EDIT_OUTLINE_ID);
|
|
39424
|
+
const markupEditOutlinePosition = markupEditOutlineElm.position();
|
|
39425
|
+
markupEditOutlineSettings.position.x = markupEditOutlinePosition?.left;
|
|
39426
|
+
markupEditOutlineSettings.position.y = markupEditOutlinePosition?.top;
|
|
39427
|
+
markupEditOutlineSettings.width = markupEditOutlineElm.width();
|
|
39428
|
+
markupEditOutlineSettings.height = markupEditOutlineElm.height();
|
|
39429
|
+
}
|
|
39430
|
+
|
|
39431
|
+
function bindOnMarkupEditEndHandler() {
|
|
39432
|
+
window.addEventListener('keydown', onMarkupEditEnd);
|
|
39433
|
+
}
|
|
39434
|
+
|
|
39435
|
+
function unbindOnMarkupEditEndHandler() {
|
|
39436
|
+
window.removeEventListener('keydown', onMarkupEditEnd);
|
|
39437
|
+
}
|
|
39438
|
+
|
|
39439
|
+
function onMarkupEditEnd(e) {
|
|
39440
|
+
if (e.key === 'Escape' && isMarkupEdit) {
|
|
39441
|
+
endMarkupEdit();
|
|
39442
|
+
}
|
|
39443
|
+
}
|
|
39444
|
+
|
|
39445
|
+
function endMarkupEdit() {
|
|
39446
|
+
isMarkupEdit = false;
|
|
39447
|
+
saveMarkup();
|
|
39448
|
+
removeMarkupEditOutline();
|
|
39449
|
+
unbindOnMarkupEditEndHandler();
|
|
39450
|
+
}
|
|
39451
|
+
|
|
39452
|
+
function saveMarkup() {
|
|
39453
|
+
if (markupUnderEditingSettings.issueId) {
|
|
39454
|
+
const issueIndex = context.issueList.findIndex(item => item.id === markupUnderEditingSettings.issueId);
|
|
39455
|
+
if (context.issueList[issueIndex]) {
|
|
39456
|
+
const changedFieldValueMap = new Map();
|
|
39457
|
+
changedFieldValueMap.set('markup', { ...markupUnderEditingSettings.markup });
|
|
39458
|
+
markupEditOutlineSettings = {};
|
|
39459
|
+
markupUnderEditingSettings = {};
|
|
39460
|
+
context.onIssueTileChange(context.issueList[issueIndex].item, changedFieldValueMap);
|
|
39461
|
+
}
|
|
39462
|
+
}
|
|
39463
|
+
}
|
|
39464
|
+
|
|
39465
|
+
function removeMarkupEditOutline() {
|
|
39466
|
+
document.getElementById(MARKUP_EDIT_OUTLINE_ID)?.remove();
|
|
39467
|
+
}
|
|
39468
|
+
|
|
39469
|
+
function createMarkupEditOutline(e) {
|
|
39470
|
+
if (e?.target) {
|
|
39471
|
+
removeMarkupEditOutline();
|
|
39472
|
+
const page = $(e.target).closest('.' + CSS_CLASS_PAGE);
|
|
39473
|
+
const markupSettings = getMarkupSettings(e.target);
|
|
39474
|
+
doCreateMarkupEditOutline(page, markupSettings);
|
|
39475
|
+
}
|
|
39476
|
+
}
|
|
39477
|
+
|
|
39478
|
+
function reloadMarkupEditOutlineSettings(page, isEventPageRendered) {
|
|
39479
|
+
if (markupUnderEditingSettings?.markup?.pageNr && page === markupUnderEditingSettings.markup.pageNr) {
|
|
39480
|
+
if (markupUnderEditingSettings.isSimple) {
|
|
39481
|
+
doCreateMarkupEditOutline($('.' + CSS_CLASS_PAGE + '[data-page-number="' + page + '"]'), markupUnderEditingSettings);
|
|
39482
|
+
} else {
|
|
39483
|
+
let svgsketch = getSvgSketchElmByPageNr(markupUnderEditingSettings.markup.pageNr);
|
|
39484
|
+
if (isEventPageRendered && !(svgsketch?.length)) {
|
|
39485
|
+
const interval = setInterval(() => {
|
|
39486
|
+
svgsketch = getSvgSketchElmByPageNr(markupUnderEditingSettings.markup.pageNr);
|
|
39487
|
+
if (svgsketch?.length) {
|
|
39488
|
+
clearInterval(interval);
|
|
39489
|
+
doCreateMarkupEditOutline($('.' + CSS_CLASS_PAGE + '[data-page-number="' + page + '"]'), markupUnderEditingSettings);
|
|
39490
|
+
}
|
|
39491
|
+
}, 50);
|
|
39492
|
+
} else {
|
|
39493
|
+
doCreateMarkupEditOutline($('.' + CSS_CLASS_PAGE + '[data-page-number="' + page + '"]'), markupUnderEditingSettings);
|
|
39494
|
+
}
|
|
39495
|
+
}
|
|
39496
|
+
}
|
|
39497
|
+
}
|
|
39498
|
+
|
|
39499
|
+
function doCreateMarkupEditOutline(page, markupSettings) {
|
|
39500
|
+
const outline = $('<div id="' + MARKUP_EDIT_OUTLINE_ID + '"></div>');
|
|
39501
|
+
const isMarkupSipmle = markupSettings.markup.svg ? false : true;
|
|
39502
|
+
if (!isMarkupSipmle) {
|
|
39503
|
+
addResizerToMarkupEditOutline(outline);
|
|
39504
|
+
}
|
|
39505
|
+
bindMarkupEditOutlineMouseDownHandler(outline);
|
|
39506
|
+
const outlineSettings = getMarkupEditOutlineSettings(markupSettings, isMarkupSipmle);
|
|
39507
|
+
markupEditOutlineSettings = outlineSettings;
|
|
39508
|
+
if (isMarkupSipmle) {
|
|
39509
|
+
markupEditOutlineSettings.isSimple = true;
|
|
39510
|
+
}
|
|
39511
|
+
setMarkupOutlineEditStyles(outline, outlineSettings);
|
|
39512
|
+
page.append(outline);
|
|
39513
|
+
}
|
|
39514
|
+
|
|
39515
|
+
function setMarkupOutlineEditStyles(outlineElm, outlineSettings) {
|
|
39516
|
+
setMarkupOutlinePosition(outlineElm, outlineSettings.position.x, outlineSettings.position.y);
|
|
39517
|
+
setMarkupOutlineSize(outlineElm, outlineSettings.width, outlineSettings.height);
|
|
39518
|
+
if (markupEditOutlineSettings.isSimple) {
|
|
39519
|
+
const rotation = getPdfPagesRotation();
|
|
39520
|
+
outlineElm.css('transform-origin', 'top left').css('transform', 'rotate(' + rotation + 'deg)');
|
|
39521
|
+
}
|
|
39522
|
+
}
|
|
39523
|
+
|
|
39524
|
+
function setMarkupOutlinePosition(outlineElm, x, y) {
|
|
39525
|
+
outlineElm.css('top', y + 'px');
|
|
39526
|
+
outlineElm.css('left', x + 'px');
|
|
39527
|
+
}
|
|
39528
|
+
|
|
39529
|
+
function setMarkupOutlineSize(outlineElm, width, height) {
|
|
39530
|
+
outlineElm.width(width);
|
|
39531
|
+
outlineElm.height(height);
|
|
39532
|
+
}
|
|
39533
|
+
|
|
39534
|
+
function getMarkupEditOutlineSettings(markupSettings, isMarkupSimple) {
|
|
39535
|
+
const rotation = getPdfPagesRotation();
|
|
39536
|
+
const scale = getPdfCanvasScale();
|
|
39537
|
+
const size = getMarkupEditOutlineSize(markupSettings, rotation, scale, isMarkupSimple);
|
|
39538
|
+
|
|
39539
|
+
const settings = {
|
|
39540
|
+
position: getMarkupEditOutlinePosition(markupSettings, rotation, scale, isMarkupSimple),
|
|
39541
|
+
width: size.width,
|
|
39542
|
+
height: size.height
|
|
39543
|
+
};
|
|
39544
|
+
|
|
39545
|
+
return settings;
|
|
39546
|
+
}
|
|
39547
|
+
|
|
39548
|
+
function getMarkupEditOutlineSize(markupSettings, rotation, scale, isMarkupSimple) {
|
|
39549
|
+
if (isMarkupSimple) {
|
|
39550
|
+
return getMarkupSimpleEditOutlineSize(markupSettings, scale);
|
|
39551
|
+
} else {
|
|
39552
|
+
if (rotation === 0 || rotation === 180) {
|
|
39553
|
+
return {
|
|
39554
|
+
width: markupSettings.markup.svg.width * scale,
|
|
39555
|
+
height: markupSettings.markup.svg.height * scale
|
|
39556
|
+
};
|
|
39557
|
+
}
|
|
39558
|
+
if (rotation === 90 || rotation === 270) {
|
|
39559
|
+
return {
|
|
39560
|
+
width: markupSettings.markup.svg.height * scale,
|
|
39561
|
+
height: markupSettings.markup.svg.width * scale
|
|
39562
|
+
};
|
|
39563
|
+
}
|
|
39564
|
+
}
|
|
39565
|
+
}
|
|
39566
|
+
|
|
39567
|
+
function getMarkupSimpleEditOutlineSize(markupSettings, scale) {
|
|
39568
|
+
const elm = $('.pdf-note#' + markupSettings.issueId);
|
|
39569
|
+
return {
|
|
39570
|
+
width: (elm.outerWidth() * scale + 1),
|
|
39571
|
+
height: (elm.outerHeight() * scale + 1)
|
|
39572
|
+
};
|
|
39573
|
+
}
|
|
39574
|
+
|
|
39575
|
+
function getSvgSketchElmByPageNr(pageNr) {
|
|
39576
|
+
return svgsketchElm = $('#svgsketch-' + pageNr);
|
|
39577
|
+
}
|
|
39578
|
+
|
|
39579
|
+
function getMarkupEditOutlinePosition(markupSettings, rotation, scale, isMarkupSimple) {
|
|
39580
|
+
if (isMarkupSimple) {
|
|
39581
|
+
return getMarkupSimpleEditOutlinePosition(markupSettings, scale, rotation);
|
|
39582
|
+
} else {
|
|
39583
|
+
const svgsketchElm = getSvgSketchElmByPageNr(markupSettings.markup.pageNr);
|
|
39584
|
+
const svgsketchWidth = svgsketchElm.width();
|
|
39585
|
+
const svgsketchHeight = svgsketchElm.height();
|
|
39586
|
+
if (rotation === 90) {
|
|
39587
|
+
return getMarkupEditOutlinePositionRotation90Deg(markupSettings, scale, svgsketchWidth);
|
|
39588
|
+
} else if (rotation === 180) {
|
|
39589
|
+
return getMarkupEditOutlinePositionRotation180Deg(markupSettings, scale, svgsketchWidth, svgsketchHeight);
|
|
39590
|
+
} else if (rotation === 270) {
|
|
39591
|
+
return getMarkupEditOutlinePositionRotation270Deg(markupSettings, scale, svgsketchHeight);
|
|
39592
|
+
} else {
|
|
39593
|
+
return getMarkupEditOutlinePositionRotation0Deg(markupSettings, scale);
|
|
39594
|
+
}
|
|
39595
|
+
}
|
|
39596
|
+
}
|
|
39597
|
+
|
|
39598
|
+
function getMarkupSimpleEditOutlinePosition(markupSettings, scale, rotation) {
|
|
39599
|
+
const data = {
|
|
39600
|
+
position: {
|
|
39601
|
+
x: markupSettings.markup.position.x * scale,
|
|
39602
|
+
y: markupSettings.markup.position.y * scale,
|
|
39603
|
+
},
|
|
39604
|
+
pageNr: markupSettings.markup.pageNr
|
|
39605
|
+
};
|
|
39606
|
+
const positionWithRotation = rotation > 0 ? getNoteLabelPositionWithRotation(data, rotation) : data.position;
|
|
39607
|
+
return positionWithRotation;
|
|
39608
|
+
}
|
|
39609
|
+
|
|
39610
|
+
function getMarkupEditOutlinePositionRotation0Deg(markupSettings, scale) {
|
|
39611
|
+
const position = {
|
|
39612
|
+
x: markupSettings.markup.svg.position.x * scale,
|
|
39613
|
+
y: markupSettings.markup.svg.position.y * scale
|
|
39614
|
+
};
|
|
39615
|
+
return position;
|
|
39616
|
+
}
|
|
39617
|
+
|
|
39618
|
+
function getMarkupEditOutlinePositionRotation90Deg(markupSettings, scale, svgsketchWidth) {
|
|
39619
|
+
const position = {
|
|
39620
|
+
x: svgsketchWidth - (markupSettings.markup.svg.position.y + markupSettings.markup.svg.height) * scale,
|
|
39621
|
+
y: markupSettings.markup.svg.position.x * scale
|
|
39622
|
+
};
|
|
39623
|
+
return position;
|
|
39624
|
+
}
|
|
39625
|
+
|
|
39626
|
+
function getMarkupEditOutlinePositionRotation180Deg(markupSettings, scale, svgsketchWidth, svgsketchHeight) {
|
|
39627
|
+
const position = {
|
|
39628
|
+
x: svgsketchWidth - (markupSettings.markup.svg.position.x + markupSettings.markup.svg.width) * scale,
|
|
39629
|
+
y: svgsketchHeight - (markupSettings.markup.svg.position.y + markupSettings.markup.svg.height) * scale
|
|
39630
|
+
};
|
|
39631
|
+
return position;
|
|
39632
|
+
}
|
|
39633
|
+
|
|
39634
|
+
function getMarkupEditOutlinePositionRotation270Deg(markupSettings, scale, svgsketchHeight) {
|
|
39635
|
+
const position = {
|
|
39636
|
+
x: markupSettings.markup.svg.position.y * scale,
|
|
39637
|
+
y: svgsketchHeight - (markupSettings.markup.svg.position.x + markupSettings.markup.svg.width) * scale
|
|
39638
|
+
};
|
|
39639
|
+
return position;
|
|
39640
|
+
}
|
|
39641
|
+
|
|
39642
|
+
function getMarkupSettings(target) {
|
|
39643
|
+
const issue = context.issueList.find(item => item.id === target.id);
|
|
39644
|
+
if (issue) {
|
|
39645
|
+
const markup = issue?.markup ? JSON.parse(issue?.markup) : undefined;
|
|
39646
|
+
markupUnderEditingSettings = { issueId: issue.id, markup: markup }
|
|
39647
|
+
}
|
|
39648
|
+
return markupUnderEditingSettings;
|
|
39649
|
+
}
|
|
39650
|
+
|
|
39651
|
+
function bindMarkupEditOutlineMouseDownHandler(outline) {
|
|
39652
|
+
outline.on('mousedown', onMarkupEditOutlineMouseDown);
|
|
39653
|
+
}
|
|
39654
|
+
|
|
39655
|
+
function bindMouseUpEventHandler() {
|
|
39656
|
+
window.addEventListener('mouseup', onMouseUpEventHandler);
|
|
39657
|
+
}
|
|
39658
|
+
|
|
39659
|
+
function unbindMouseUpEventHandler() {
|
|
39660
|
+
window.removeEventListener('mouseup', onMouseUpEventHandler);
|
|
39661
|
+
}
|
|
39662
|
+
|
|
39663
|
+
function onMouseUpEventHandler(e) {
|
|
39664
|
+
if (isMarkupEdit && isMarkupMove) {
|
|
39665
|
+
onMarkupEditOutlineMouseUp(e);
|
|
39666
|
+
}
|
|
39667
|
+
if (isMarkupEdit && isMarkupResize) {
|
|
39668
|
+
onMarkupResizerMouseUp(e);
|
|
39669
|
+
}
|
|
39670
|
+
}
|
|
39671
|
+
|
|
39672
|
+
function addResizerToMarkupEditOutline(outlineElm) {
|
|
39673
|
+
const resizerIdSuffixList = ['TL', 'TC', 'TR', 'CL', 'CR', 'BL', 'BC', 'BR'];
|
|
39674
|
+
resizerIdSuffixList.forEach(function (suffix) {
|
|
39675
|
+
const resizer = $('<div id="' + MARKUP_RESIZER_ID_PREFIX + suffix + '" class="' + CSS_CLASS_MARKUP_RESIZER + ' ' + CSS_CLASS_MARKUP_RESIZER + '-' + suffix.toLowerCase() + '" />');
|
|
39676
|
+
resizer.on('mousedown', onMarkupResizerMouseDown);
|
|
39677
|
+
outlineElm.append(resizer);
|
|
39678
|
+
});
|
|
39679
|
+
}
|
|
39680
|
+
|
|
39681
|
+
function initMarkupEditContextMenu() {
|
|
39682
|
+
const selector = '.' + CSS_CLASS_PDF_NOTE;
|
|
39683
|
+
$.contextMenu({
|
|
39684
|
+
selector: selector,
|
|
39685
|
+
trigger: 'right',
|
|
39686
|
+
build: function ($triggerElement, e) {
|
|
39687
|
+
return {
|
|
39688
|
+
callback: function (key, options) { },
|
|
39689
|
+
items: getMarkupEditContextMenuItemList($triggerElement, e)
|
|
39690
|
+
}
|
|
39691
|
+
}
|
|
39692
|
+
});
|
|
39693
|
+
}
|
|
39694
|
+
|
|
39695
|
+
function getMarkupEditContextMenuItemList($triggerElement, e) {
|
|
39696
|
+
const menuItems = {
|
|
39697
|
+
"editMarkup": {
|
|
39698
|
+
name: context.createLocale('app.viewer.pdf.contextMenu.edit'),
|
|
39699
|
+
callback: function (key, options) {
|
|
39700
|
+
onMarkupEditStart(e);
|
|
39701
|
+
}
|
|
39702
|
+
},
|
|
39703
|
+
"sep1": "---------",
|
|
39704
|
+
"quit": {
|
|
39705
|
+
name: context.createLocale('app.viewer.pdf.contextMenu.cancel'),
|
|
39706
|
+
icon: function () {
|
|
39707
|
+
return 'context-menu-icon context-menu-icon-quit';
|
|
39708
|
+
},
|
|
39709
|
+
}
|
|
39710
|
+
};
|
|
39711
|
+
return menuItems;
|
|
39712
|
+
}
|
|
39713
|
+
|
|
39714
|
+
function setPdfViewerCursorToolMode() {
|
|
39715
|
+
const btnCursorTool = $('#cursorSelectTool');
|
|
39716
|
+
const btnDrawAnnotation = $('#btnDrawAnnotation');
|
|
39717
|
+
if (btnDrawAnnotation.hasClass('toggled')) {
|
|
39718
|
+
btnDrawAnnotation.click();
|
|
39719
|
+
}
|
|
39720
|
+
if (!btnCursorTool.hasClass('toggled')) {
|
|
39721
|
+
btnCursorTool.click();
|
|
39722
|
+
}
|
|
39723
|
+
}
|
|
39724
|
+
|
|
39725
|
+
initMarkupEditContextMenu();
|
|
38778
39726
|
$(document).ready(function() {
|
|
38779
39727
|
context.openFile();
|
|
38780
39728
|
|