@libresign/pdf-elements 0.2.0 → 0.2.2
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/dist/pdf-elements.common.js +1544 -1395
- package/dist/pdf-elements.common.js.map +1 -1
- package/dist/pdf-elements.css +1 -1
- package/dist/pdf-elements.umd.js +1544 -1395
- package/dist/pdf-elements.umd.js.map +1 -1
- package/dist/pdf-elements.umd.min.js +2 -2
- package/dist/pdf-elements.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/PDFElements.vue +59 -6
- package/src/index.js +6 -0
- package/src/utils/asyncReader.js +4 -0
|
@@ -180,6 +180,74 @@ module.exports = getBuiltIn('document', 'documentElement');
|
|
|
180
180
|
module.exports = {};
|
|
181
181
|
|
|
182
182
|
|
|
183
|
+
/***/ },
|
|
184
|
+
|
|
185
|
+
/***/ 531
|
|
186
|
+
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
var $ = __webpack_require__(6518);
|
|
190
|
+
var call = __webpack_require__(9565);
|
|
191
|
+
var aCallable = __webpack_require__(9306);
|
|
192
|
+
var anObject = __webpack_require__(8551);
|
|
193
|
+
var getIteratorDirect = __webpack_require__(1767);
|
|
194
|
+
var getIteratorFlattenable = __webpack_require__(8646);
|
|
195
|
+
var createIteratorProxy = __webpack_require__(9462);
|
|
196
|
+
var iteratorClose = __webpack_require__(9539);
|
|
197
|
+
var IS_PURE = __webpack_require__(6395);
|
|
198
|
+
var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);
|
|
199
|
+
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
|
|
200
|
+
|
|
201
|
+
var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE
|
|
202
|
+
&& !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ });
|
|
203
|
+
var flatMapWithoutClosingOnEarlyError = !IS_PURE && !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
|
|
204
|
+
&& iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError);
|
|
205
|
+
|
|
206
|
+
var FORCED = IS_PURE || FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError;
|
|
207
|
+
|
|
208
|
+
var IteratorProxy = createIteratorProxy(function () {
|
|
209
|
+
var iterator = this.iterator;
|
|
210
|
+
var mapper = this.mapper;
|
|
211
|
+
var result, inner;
|
|
212
|
+
|
|
213
|
+
while (true) {
|
|
214
|
+
if (inner = this.inner) try {
|
|
215
|
+
result = anObject(call(inner.next, inner.iterator));
|
|
216
|
+
if (!result.done) return result.value;
|
|
217
|
+
this.inner = null;
|
|
218
|
+
} catch (error) { iteratorClose(iterator, 'throw', error); }
|
|
219
|
+
|
|
220
|
+
result = anObject(call(this.next, iterator));
|
|
221
|
+
|
|
222
|
+
if (this.done = !!result.done) return;
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false);
|
|
226
|
+
} catch (error) { iteratorClose(iterator, 'throw', error); }
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// `Iterator.prototype.flatMap` method
|
|
231
|
+
// https://tc39.es/ecma262/#sec-iterator.prototype.flatmap
|
|
232
|
+
$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
|
233
|
+
flatMap: function flatMap(mapper) {
|
|
234
|
+
anObject(this);
|
|
235
|
+
try {
|
|
236
|
+
aCallable(mapper);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
iteratorClose(this, 'throw', error);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper);
|
|
242
|
+
|
|
243
|
+
return new IteratorProxy(getIteratorDirect(this), {
|
|
244
|
+
mapper: mapper,
|
|
245
|
+
inner: null
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
|
|
183
251
|
/***/ },
|
|
184
252
|
|
|
185
253
|
/***/ 616
|
|
@@ -2224,6 +2292,24 @@ var WeakMap = globalThis.WeakMap;
|
|
|
2224
2292
|
module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
|
|
2225
2293
|
|
|
2226
2294
|
|
|
2295
|
+
/***/ },
|
|
2296
|
+
|
|
2297
|
+
/***/ 8646
|
|
2298
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
var call = __webpack_require__(9565);
|
|
2302
|
+
var anObject = __webpack_require__(8551);
|
|
2303
|
+
var getIteratorDirect = __webpack_require__(1767);
|
|
2304
|
+
var getIteratorMethod = __webpack_require__(851);
|
|
2305
|
+
|
|
2306
|
+
module.exports = function (obj, stringHandling) {
|
|
2307
|
+
if (!stringHandling || typeof obj !== 'string') anObject(obj);
|
|
2308
|
+
var method = getIteratorMethod(obj);
|
|
2309
|
+
return getIteratorDirect(anObject(method !== undefined ? call(method, obj) : obj));
|
|
2310
|
+
};
|
|
2311
|
+
|
|
2312
|
+
|
|
2227
2313
|
/***/ },
|
|
2228
2314
|
|
|
2229
2315
|
/***/ 8686
|
|
@@ -2666,7 +2752,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
2666
2752
|
"default": () => (/* binding */ entry_lib)
|
|
2667
2753
|
});
|
|
2668
2754
|
|
|
2669
|
-
// UNUSED EXPORTS: PDFElements
|
|
2755
|
+
// UNUSED EXPORTS: PDFElements, setWorkerPath
|
|
2670
2756
|
|
|
2671
2757
|
;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
2672
2758
|
/* eslint-disable no-var */
|
|
@@ -2686,980 +2772,28 @@ if (typeof window !== 'undefined') {
|
|
|
2686
2772
|
// Indicate to webpack that this file can be concatenated
|
|
2687
2773
|
/* harmony default export */ const setPublicPath = (null);
|
|
2688
2774
|
|
|
2689
|
-
;// ./node_modules/
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
staticClass: "page-slot"
|
|
2712
|
-
}, [_c('div', {
|
|
2713
|
-
staticClass: "page-wrapper",
|
|
2714
|
-
on: {
|
|
2715
|
-
"mousedown": function ($event) {
|
|
2716
|
-
return _vm.selectPage(docIndex, pIndex);
|
|
2717
|
-
},
|
|
2718
|
-
"touchstart": function ($event) {
|
|
2719
|
-
return _vm.selectPage(docIndex, pIndex);
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
}, [_c('div', {
|
|
2723
|
-
staticClass: "page-canvas",
|
|
2724
|
-
class: {
|
|
2725
|
-
'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
|
|
2726
|
-
}
|
|
2727
|
-
}, [_c('PDFPage', {
|
|
2728
|
-
ref: `page${docIndex}-${pIndex}`,
|
|
2729
|
-
refInFor: true,
|
|
2730
|
-
attrs: {
|
|
2731
|
-
"page": page,
|
|
2732
|
-
"scale": _vm.scale
|
|
2733
|
-
},
|
|
2734
|
-
on: {
|
|
2735
|
-
"onMeasure": function ($event) {
|
|
2736
|
-
return _vm.onMeasure($event, docIndex, pIndex);
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
}), _c('div', {
|
|
2740
|
-
staticClass: "overlay"
|
|
2741
|
-
}, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
|
|
2742
|
-
staticClass: "preview-element",
|
|
2743
|
-
style: {
|
|
2744
|
-
left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
|
|
2745
|
-
top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
|
|
2746
|
-
width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
|
|
2747
|
-
height: `${_vm.previewElement.height * _vm.previewScale.y}px`
|
|
2748
|
-
}
|
|
2749
|
-
}, [_vm._t("custom", null, {
|
|
2750
|
-
"object": _vm.previewElement,
|
|
2751
|
-
"isSelected": false
|
|
2752
|
-
})], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
|
|
2753
|
-
return _c('DraggableElement', {
|
|
2754
|
-
key: object.id,
|
|
2755
|
-
ref: `draggable${docIndex}-${pIndex}-${object.id}`,
|
|
2756
|
-
refInFor: true,
|
|
2757
|
-
attrs: {
|
|
2758
|
-
"object": object,
|
|
2759
|
-
"pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
|
|
2760
|
-
"page-width": _vm.getPageWidth(docIndex, pIndex),
|
|
2761
|
-
"page-height": _vm.getPageHeight(docIndex, pIndex),
|
|
2762
|
-
"on-update": payload => _vm.updateObject(docIndex, object.id, payload),
|
|
2763
|
-
"on-delete": () => _vm.deleteObject(docIndex, object.id),
|
|
2764
|
-
"on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
|
|
2765
|
-
"on-drag-move": _vm.updateDraggingPosition,
|
|
2766
|
-
"on-drag-end": _vm.stopDraggingElement,
|
|
2767
|
-
"is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
|
|
2768
|
-
"dragging-client-pos": _vm.draggingClientPosition,
|
|
2769
|
-
"current-doc-index": docIndex,
|
|
2770
|
-
"current-page-index": pIndex,
|
|
2771
|
-
"global-drag-doc-index": _vm.draggingDocIndex,
|
|
2772
|
-
"global-drag-page-index": _vm.draggingPageIndex,
|
|
2773
|
-
"show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
|
|
2774
|
-
"show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
|
|
2775
|
-
},
|
|
2776
|
-
scopedSlots: _vm._u([{
|
|
2777
|
-
key: "default",
|
|
2778
|
-
fn: function (slotProps) {
|
|
2779
|
-
return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
|
|
2780
|
-
return [_vm._t("custom", null, {
|
|
2781
|
-
"object": slotProps.object,
|
|
2782
|
-
"onDelete": slotProps.onDelete,
|
|
2783
|
-
"onResize": slotProps.onResize
|
|
2784
|
-
})];
|
|
2785
|
-
}, {
|
|
2786
|
-
"object": slotProps.object,
|
|
2787
|
-
"onDelete": slotProps.onDelete,
|
|
2788
|
-
"onResize": slotProps.onResize
|
|
2789
|
-
})];
|
|
2790
|
-
}
|
|
2791
|
-
}, {
|
|
2792
|
-
key: "actions",
|
|
2793
|
-
fn: function (slotProps) {
|
|
2794
|
-
return [_vm._t("actions", null, {
|
|
2795
|
-
"object": slotProps.object,
|
|
2796
|
-
"onDelete": slotProps.onDelete
|
|
2797
|
-
})];
|
|
2798
|
-
}
|
|
2799
|
-
}], null, true)
|
|
2800
|
-
});
|
|
2801
|
-
})], 2)], 1), _vm.showPageFooter ? _c('div', {
|
|
2802
|
-
staticClass: "page-footer"
|
|
2803
|
-
}, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
|
|
2804
|
-
}), 0);
|
|
2805
|
-
}), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
|
|
2806
|
-
staticClass: "drag-portal",
|
|
2807
|
-
style: {
|
|
2808
|
-
position: 'fixed',
|
|
2809
|
-
left: `${_vm.draggingClientPosition.x}px`,
|
|
2810
|
-
top: `${_vm.draggingClientPosition.y}px`,
|
|
2811
|
-
width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
|
|
2812
|
-
height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
|
|
2813
|
-
pointerEvents: 'none'
|
|
2814
|
-
}
|
|
2815
|
-
}, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
|
|
2816
|
-
return [_vm._t("custom", null, {
|
|
2817
|
-
"object": _vm.draggingObject,
|
|
2818
|
-
"isSelected": false
|
|
2819
|
-
})];
|
|
2820
|
-
}, {
|
|
2821
|
-
"object": _vm.draggingObject,
|
|
2822
|
-
"isSelected": false
|
|
2823
|
-
})], 2) : _vm._e()]);
|
|
2824
|
-
};
|
|
2825
|
-
var staticRenderFns = [];
|
|
2826
|
-
|
|
2827
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
2828
|
-
var es_array_push = __webpack_require__(4114);
|
|
2829
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
|
|
2830
|
-
var es_iterator_constructor = __webpack_require__(8111);
|
|
2831
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
|
2832
|
-
var es_iterator_filter = __webpack_require__(2489);
|
|
2833
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
|
|
2834
|
-
var es_iterator_find = __webpack_require__(116);
|
|
2835
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
|
2836
|
-
var es_iterator_for_each = __webpack_require__(7588);
|
|
2837
|
-
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
|
|
2838
|
-
var es_iterator_map = __webpack_require__(1701);
|
|
2839
|
-
;// ./node_modules/debounce/index.js
|
|
2840
|
-
function debounce(function_, wait = 100, options = {}) {
|
|
2841
|
-
if (typeof function_ !== 'function') {
|
|
2842
|
-
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
|
|
2843
|
-
}
|
|
2844
|
-
|
|
2845
|
-
if (wait < 0) {
|
|
2846
|
-
throw new RangeError('`wait` must not be negative.');
|
|
2847
|
-
}
|
|
2848
|
-
|
|
2849
|
-
if (typeof options === 'boolean') {
|
|
2850
|
-
throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
const {immediate} = options;
|
|
2854
|
-
|
|
2855
|
-
let storedContext;
|
|
2856
|
-
let storedArguments;
|
|
2857
|
-
let timeoutId;
|
|
2858
|
-
let timestamp;
|
|
2859
|
-
let result;
|
|
2860
|
-
|
|
2861
|
-
function run() {
|
|
2862
|
-
const callContext = storedContext;
|
|
2863
|
-
const callArguments = storedArguments;
|
|
2864
|
-
storedContext = undefined;
|
|
2865
|
-
storedArguments = undefined;
|
|
2866
|
-
result = function_.apply(callContext, callArguments);
|
|
2867
|
-
return result;
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
|
-
function later() {
|
|
2871
|
-
const last = Date.now() - timestamp;
|
|
2872
|
-
|
|
2873
|
-
if (last < wait && last >= 0) {
|
|
2874
|
-
timeoutId = setTimeout(later, wait - last);
|
|
2875
|
-
} else {
|
|
2876
|
-
timeoutId = undefined;
|
|
2877
|
-
|
|
2878
|
-
if (!immediate) {
|
|
2879
|
-
result = run();
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
const debounced = function (...arguments_) {
|
|
2885
|
-
if (
|
|
2886
|
-
storedContext
|
|
2887
|
-
&& this !== storedContext
|
|
2888
|
-
&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
|
|
2889
|
-
) {
|
|
2890
|
-
throw new Error('Debounced method called with different contexts of the same prototype.');
|
|
2891
|
-
}
|
|
2892
|
-
|
|
2893
|
-
storedContext = this; // eslint-disable-line unicorn/no-this-assignment
|
|
2894
|
-
storedArguments = arguments_;
|
|
2895
|
-
timestamp = Date.now();
|
|
2896
|
-
|
|
2897
|
-
const callNow = immediate && !timeoutId;
|
|
2898
|
-
|
|
2899
|
-
if (!timeoutId) {
|
|
2900
|
-
timeoutId = setTimeout(later, wait);
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
if (callNow) {
|
|
2904
|
-
result = run();
|
|
2905
|
-
return result;
|
|
2906
|
-
}
|
|
2907
|
-
|
|
2908
|
-
return undefined;
|
|
2909
|
-
};
|
|
2910
|
-
|
|
2911
|
-
Object.defineProperty(debounced, 'isPending', {
|
|
2912
|
-
get() {
|
|
2913
|
-
return timeoutId !== undefined;
|
|
2914
|
-
},
|
|
2915
|
-
});
|
|
2916
|
-
|
|
2917
|
-
debounced.clear = () => {
|
|
2918
|
-
if (!timeoutId) {
|
|
2919
|
-
return;
|
|
2920
|
-
}
|
|
2921
|
-
|
|
2922
|
-
clearTimeout(timeoutId);
|
|
2923
|
-
timeoutId = undefined;
|
|
2924
|
-
storedContext = undefined;
|
|
2925
|
-
storedArguments = undefined;
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
|
-
debounced.flush = () => {
|
|
2929
|
-
if (!timeoutId) {
|
|
2930
|
-
return;
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
debounced.trigger();
|
|
2934
|
-
};
|
|
2935
|
-
|
|
2936
|
-
debounced.trigger = () => {
|
|
2937
|
-
result = run();
|
|
2938
|
-
|
|
2939
|
-
debounced.clear();
|
|
2940
|
-
};
|
|
2941
|
-
|
|
2942
|
-
return debounced;
|
|
2943
|
-
}
|
|
2944
|
-
|
|
2945
|
-
;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
|
|
2946
|
-
var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
|
|
2947
|
-
var _vm = this,
|
|
2948
|
-
_c = _vm._self._c;
|
|
2949
|
-
return _c('canvas', {
|
|
2950
|
-
ref: "canvas"
|
|
2951
|
-
});
|
|
2952
|
-
};
|
|
2953
|
-
var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
|
|
2954
|
-
|
|
2955
|
-
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
|
|
2956
|
-
/* harmony default export */ const PDFPagevue_type_script_lang_js = ({
|
|
2957
|
-
name: 'PDFPage',
|
|
2958
|
-
props: {
|
|
2959
|
-
page: {
|
|
2960
|
-
type: Promise,
|
|
2961
|
-
required: true
|
|
2962
|
-
},
|
|
2963
|
-
scale: {
|
|
2964
|
-
type: Number,
|
|
2965
|
-
default: 1
|
|
2966
|
-
}
|
|
2967
|
-
},
|
|
2968
|
-
data() {
|
|
2969
|
-
return {
|
|
2970
|
-
dynamicScale: this.scale,
|
|
2971
|
-
isRendering: false,
|
|
2972
|
-
boundMeasure: null
|
|
2973
|
-
};
|
|
2974
|
-
},
|
|
2975
|
-
watch: {
|
|
2976
|
-
scale(newScale) {
|
|
2977
|
-
this.dynamicScale = newScale;
|
|
2978
|
-
this.render();
|
|
2979
|
-
}
|
|
2980
|
-
},
|
|
2981
|
-
mounted() {
|
|
2982
|
-
this.boundMeasure = this.measure.bind(this);
|
|
2983
|
-
window.addEventListener('resize', this.boundMeasure);
|
|
2984
|
-
this.render();
|
|
2985
|
-
},
|
|
2986
|
-
beforeUnmount() {
|
|
2987
|
-
if (this.boundMeasure) {
|
|
2988
|
-
window.removeEventListener('resize', this.boundMeasure);
|
|
2989
|
-
}
|
|
2990
|
-
},
|
|
2991
|
-
methods: {
|
|
2992
|
-
getCanvasMeasurement() {
|
|
2993
|
-
return {
|
|
2994
|
-
canvasWidth: this.$refs.canvas.width,
|
|
2995
|
-
canvasHeight: this.$refs.canvas.height
|
|
2996
|
-
};
|
|
2997
|
-
},
|
|
2998
|
-
measure() {
|
|
2999
|
-
this.$emit('onMeasure', {
|
|
3000
|
-
scale: this.dynamicScale
|
|
3001
|
-
});
|
|
3002
|
-
},
|
|
3003
|
-
async render() {
|
|
3004
|
-
if (this.isRendering) return;
|
|
3005
|
-
this.isRendering = true;
|
|
3006
|
-
try {
|
|
3007
|
-
const _page = await this.page;
|
|
3008
|
-
const canvas = this.$refs.canvas;
|
|
3009
|
-
const context = canvas.getContext('2d');
|
|
3010
|
-
const viewport = _page.getViewport({
|
|
3011
|
-
scale: this.dynamicScale
|
|
3012
|
-
});
|
|
3013
|
-
canvas.width = viewport.width;
|
|
3014
|
-
canvas.height = viewport.height;
|
|
3015
|
-
await _page.render({
|
|
3016
|
-
canvasContext: context,
|
|
3017
|
-
viewport
|
|
3018
|
-
}).promise;
|
|
3019
|
-
this.measure();
|
|
3020
|
-
} finally {
|
|
3021
|
-
this.isRendering = false;
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
});
|
|
3026
|
-
;// ./src/components/PDFPage.vue?vue&type=script&lang=js
|
|
3027
|
-
/* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
|
|
3028
|
-
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
|
|
3029
|
-
// extracted by mini-css-extract-plugin
|
|
3030
|
-
|
|
3031
|
-
;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
|
|
3032
|
-
|
|
3033
|
-
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
3034
|
-
/* globals __VUE_SSR_CONTEXT__ */
|
|
3035
|
-
|
|
3036
|
-
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
3037
|
-
// This module is a runtime utility for cleaner component module output and will
|
|
3038
|
-
// be included in the final webpack user bundle.
|
|
3039
|
-
|
|
3040
|
-
function normalizeComponent(
|
|
3041
|
-
scriptExports,
|
|
3042
|
-
render,
|
|
3043
|
-
staticRenderFns,
|
|
3044
|
-
functionalTemplate,
|
|
3045
|
-
injectStyles,
|
|
3046
|
-
scopeId,
|
|
3047
|
-
moduleIdentifier /* server only */,
|
|
3048
|
-
shadowMode /* vue-cli only */
|
|
3049
|
-
) {
|
|
3050
|
-
// Vue.extend constructor export interop
|
|
3051
|
-
var options =
|
|
3052
|
-
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
3053
|
-
|
|
3054
|
-
// render functions
|
|
3055
|
-
if (render) {
|
|
3056
|
-
options.render = render
|
|
3057
|
-
options.staticRenderFns = staticRenderFns
|
|
3058
|
-
options._compiled = true
|
|
3059
|
-
}
|
|
3060
|
-
|
|
3061
|
-
// functional template
|
|
3062
|
-
if (functionalTemplate) {
|
|
3063
|
-
options.functional = true
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
// scopedId
|
|
3067
|
-
if (scopeId) {
|
|
3068
|
-
options._scopeId = 'data-v-' + scopeId
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
var hook
|
|
3072
|
-
if (moduleIdentifier) {
|
|
3073
|
-
// server build
|
|
3074
|
-
hook = function (context) {
|
|
3075
|
-
// 2.3 injection
|
|
3076
|
-
context =
|
|
3077
|
-
context || // cached call
|
|
3078
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
3079
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
3080
|
-
// 2.2 with runInNewContext: true
|
|
3081
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
3082
|
-
context = __VUE_SSR_CONTEXT__
|
|
3083
|
-
}
|
|
3084
|
-
// inject component styles
|
|
3085
|
-
if (injectStyles) {
|
|
3086
|
-
injectStyles.call(this, context)
|
|
3087
|
-
}
|
|
3088
|
-
// register component module identifier for async chunk inferrence
|
|
3089
|
-
if (context && context._registeredComponents) {
|
|
3090
|
-
context._registeredComponents.add(moduleIdentifier)
|
|
3091
|
-
}
|
|
3092
|
-
}
|
|
3093
|
-
// used by ssr in case component is cached and beforeCreate
|
|
3094
|
-
// never gets called
|
|
3095
|
-
options._ssrRegister = hook
|
|
3096
|
-
} else if (injectStyles) {
|
|
3097
|
-
hook = shadowMode
|
|
3098
|
-
? function () {
|
|
3099
|
-
injectStyles.call(
|
|
3100
|
-
this,
|
|
3101
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
3102
|
-
)
|
|
3103
|
-
}
|
|
3104
|
-
: injectStyles
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
if (hook) {
|
|
3108
|
-
if (options.functional) {
|
|
3109
|
-
// for template-only hot-reload because in that case the render fn doesn't
|
|
3110
|
-
// go through the normalizer
|
|
3111
|
-
options._injectStyles = hook
|
|
3112
|
-
// register for functional component in vue file
|
|
3113
|
-
var originalRender = options.render
|
|
3114
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
3115
|
-
hook.call(context)
|
|
3116
|
-
return originalRender(h, context)
|
|
3117
|
-
}
|
|
3118
|
-
} else {
|
|
3119
|
-
// inject component registration as beforeCreate hook
|
|
3120
|
-
var existing = options.beforeCreate
|
|
3121
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
return {
|
|
3126
|
-
exports: scriptExports,
|
|
3127
|
-
options: options
|
|
3128
|
-
}
|
|
3129
|
-
}
|
|
3130
|
-
|
|
3131
|
-
;// ./src/components/PDFPage.vue
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
;
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
/* normalize component */
|
|
3139
|
-
|
|
3140
|
-
var component = normalizeComponent(
|
|
3141
|
-
components_PDFPagevue_type_script_lang_js,
|
|
3142
|
-
PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
|
|
3143
|
-
PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
|
|
3144
|
-
false,
|
|
3145
|
-
null,
|
|
3146
|
-
"2c9e224a",
|
|
3147
|
-
null
|
|
3148
|
-
|
|
3149
|
-
)
|
|
3150
|
-
|
|
3151
|
-
/* harmony default export */ const PDFPage = (component.exports);
|
|
3152
|
-
;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
|
|
3153
|
-
var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
|
|
3154
|
-
var _vm = this,
|
|
3155
|
-
_c = _vm._self._c;
|
|
3156
|
-
return _c('div', {
|
|
3157
|
-
staticClass: "draggable-wrapper"
|
|
3158
|
-
}, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
|
|
3159
|
-
staticClass: "actions-toolbar",
|
|
3160
|
-
style: _vm.toolbarStyle
|
|
3161
|
-
}, [_vm._t("actions", function () {
|
|
3162
|
-
return [_c('button', {
|
|
3163
|
-
staticClass: "action-btn",
|
|
3164
|
-
attrs: {
|
|
3165
|
-
"type": "button",
|
|
3166
|
-
"title": "Delete"
|
|
3167
|
-
},
|
|
3168
|
-
on: {
|
|
3169
|
-
"click": function ($event) {
|
|
3170
|
-
$event.stopPropagation();
|
|
3171
|
-
return _vm.onDelete.apply(null, arguments);
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
}, [_c('svg', {
|
|
3175
|
-
attrs: {
|
|
3176
|
-
"width": "16",
|
|
3177
|
-
"height": "16",
|
|
3178
|
-
"viewBox": "0 0 16 16",
|
|
3179
|
-
"fill": "currentColor"
|
|
3180
|
-
}
|
|
3181
|
-
}, [_c('path', {
|
|
3182
|
-
attrs: {
|
|
3183
|
-
"d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
|
|
3184
|
-
}
|
|
3185
|
-
})])])];
|
|
3186
|
-
}, {
|
|
3187
|
-
"object": _vm.object,
|
|
3188
|
-
"onDelete": _vm.onDelete
|
|
3189
|
-
})], 2) : _vm._e(), _c('div', {
|
|
3190
|
-
staticClass: "draggable-element",
|
|
3191
|
-
class: {
|
|
3192
|
-
selected: _vm.isSelected && _vm.showSelectionUi
|
|
3193
|
-
},
|
|
3194
|
-
style: [_vm.elementStyle, _vm.dragElementStyle],
|
|
3195
|
-
attrs: {
|
|
3196
|
-
"draggable": "false"
|
|
3197
|
-
},
|
|
3198
|
-
on: {
|
|
3199
|
-
"dragstart": function ($event) {
|
|
3200
|
-
$event.preventDefault();
|
|
3201
|
-
},
|
|
3202
|
-
"mousedown": _vm.handleElementClick,
|
|
3203
|
-
"touchstart": _vm.handleElementClick
|
|
3204
|
-
}
|
|
3205
|
-
}, [_vm._t("default", null, {
|
|
3206
|
-
"object": _vm.object,
|
|
3207
|
-
"isSelected": _vm.isSelected,
|
|
3208
|
-
"onDelete": _vm.onDelete,
|
|
3209
|
-
"onResize": _vm.startResizeFromSlot
|
|
3210
|
-
}), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
|
|
3211
|
-
return _c('button', {
|
|
3212
|
-
key: dir,
|
|
3213
|
-
staticClass: "resize-handle",
|
|
3214
|
-
class: `handle-${dir}`,
|
|
3215
|
-
attrs: {
|
|
3216
|
-
"type": "button"
|
|
3217
|
-
},
|
|
3218
|
-
on: {
|
|
3219
|
-
"mousedown": function ($event) {
|
|
3220
|
-
$event.stopPropagation();
|
|
3221
|
-
$event.preventDefault();
|
|
3222
|
-
return _vm.startResize(dir, $event);
|
|
3223
|
-
},
|
|
3224
|
-
"touchstart": function ($event) {
|
|
3225
|
-
$event.stopPropagation();
|
|
3226
|
-
$event.preventDefault();
|
|
3227
|
-
return _vm.startResize(dir, $event);
|
|
3228
|
-
}
|
|
3229
|
-
}
|
|
3230
|
-
});
|
|
3231
|
-
}) : _vm._e()], 2)]);
|
|
3232
|
-
};
|
|
3233
|
-
var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
|
|
3234
|
-
|
|
3235
|
-
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
|
|
3236
|
-
/* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
|
|
3237
|
-
name: 'DraggableElement',
|
|
3238
|
-
props: {
|
|
3239
|
-
object: {
|
|
3240
|
-
type: Object,
|
|
3241
|
-
required: true
|
|
3242
|
-
},
|
|
3243
|
-
pagesScale: {
|
|
3244
|
-
type: Number,
|
|
3245
|
-
default: 1
|
|
3246
|
-
},
|
|
3247
|
-
pageWidth: {
|
|
3248
|
-
type: Number,
|
|
3249
|
-
required: true
|
|
3250
|
-
},
|
|
3251
|
-
pageHeight: {
|
|
3252
|
-
type: Number,
|
|
3253
|
-
required: true
|
|
3254
|
-
},
|
|
3255
|
-
onUpdate: {
|
|
3256
|
-
type: Function,
|
|
3257
|
-
default: () => {}
|
|
3258
|
-
},
|
|
3259
|
-
onDelete: {
|
|
3260
|
-
type: Function,
|
|
3261
|
-
default: () => {}
|
|
3262
|
-
},
|
|
3263
|
-
onDragStart: {
|
|
3264
|
-
type: Function,
|
|
3265
|
-
default: () => {}
|
|
3266
|
-
},
|
|
3267
|
-
onDragMove: {
|
|
3268
|
-
type: Function,
|
|
3269
|
-
default: () => {}
|
|
3270
|
-
},
|
|
3271
|
-
onDragEnd: {
|
|
3272
|
-
type: Function,
|
|
3273
|
-
default: () => {}
|
|
3274
|
-
},
|
|
3275
|
-
isBeingDraggedGlobally: {
|
|
3276
|
-
type: Boolean,
|
|
3277
|
-
default: false
|
|
3278
|
-
},
|
|
3279
|
-
draggingClientPos: {
|
|
3280
|
-
type: Object,
|
|
3281
|
-
default: () => ({
|
|
3282
|
-
x: 0,
|
|
3283
|
-
y: 0
|
|
3284
|
-
})
|
|
3285
|
-
},
|
|
3286
|
-
currentDocIndex: {
|
|
3287
|
-
type: Number,
|
|
3288
|
-
default: -1
|
|
3289
|
-
},
|
|
3290
|
-
currentPageIndex: {
|
|
3291
|
-
type: Number,
|
|
3292
|
-
default: -1
|
|
3293
|
-
},
|
|
3294
|
-
globalDragDocIndex: {
|
|
3295
|
-
type: Number,
|
|
3296
|
-
default: -1
|
|
3297
|
-
},
|
|
3298
|
-
globalDragPageIndex: {
|
|
3299
|
-
type: Number,
|
|
3300
|
-
default: -1
|
|
3301
|
-
},
|
|
3302
|
-
showSelectionUi: {
|
|
3303
|
-
type: Boolean,
|
|
3304
|
-
default: true
|
|
3305
|
-
},
|
|
3306
|
-
showDefaultActions: {
|
|
3307
|
-
type: Boolean,
|
|
3308
|
-
default: true
|
|
3309
|
-
}
|
|
3310
|
-
},
|
|
3311
|
-
data() {
|
|
3312
|
-
return {
|
|
3313
|
-
isSelected: false,
|
|
3314
|
-
mode: 'idle',
|
|
3315
|
-
direction: '',
|
|
3316
|
-
startX: 0,
|
|
3317
|
-
startY: 0,
|
|
3318
|
-
startLeft: 0,
|
|
3319
|
-
startTop: 0,
|
|
3320
|
-
startWidth: 0,
|
|
3321
|
-
startHeight: 0,
|
|
3322
|
-
offsetX: 0,
|
|
3323
|
-
offsetY: 0,
|
|
3324
|
-
resizeOffsetX: 0,
|
|
3325
|
-
resizeOffsetY: 0,
|
|
3326
|
-
resizeOffsetW: 0,
|
|
3327
|
-
resizeOffsetH: 0,
|
|
3328
|
-
aspectRatio: 1,
|
|
3329
|
-
lastMouseX: 0,
|
|
3330
|
-
lastMouseY: 0,
|
|
3331
|
-
pointerOffsetDoc: {
|
|
3332
|
-
x: 0,
|
|
3333
|
-
y: 0
|
|
3334
|
-
},
|
|
3335
|
-
currentPageRect: null,
|
|
3336
|
-
rafId: null
|
|
3337
|
-
};
|
|
3338
|
-
},
|
|
3339
|
-
computed: {
|
|
3340
|
-
resizeDirections() {
|
|
3341
|
-
return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
|
3342
|
-
},
|
|
3343
|
-
elementStyle() {
|
|
3344
|
-
const scale = this.pagesScale || 1;
|
|
3345
|
-
const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
|
|
3346
|
-
const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
|
|
3347
|
-
const currentWidth = this.object.width + this.resizeOffsetW;
|
|
3348
|
-
const currentHeight = this.object.height + this.resizeOffsetH;
|
|
3349
|
-
return {
|
|
3350
|
-
left: `${currentX * scale}px`,
|
|
3351
|
-
top: `${currentY * scale}px`,
|
|
3352
|
-
width: `${currentWidth * scale}px`,
|
|
3353
|
-
height: `${currentHeight * scale}px`
|
|
3354
|
-
};
|
|
3355
|
-
},
|
|
3356
|
-
toolbarStyle() {
|
|
3357
|
-
const scale = this.pagesScale || 1;
|
|
3358
|
-
const x = this.object.x + this.offsetX + this.resizeOffsetX;
|
|
3359
|
-
const y = this.object.y + this.offsetY + this.resizeOffsetY;
|
|
3360
|
-
const width = this.object.width + this.resizeOffsetW;
|
|
3361
|
-
return {
|
|
3362
|
-
left: `${(x + width / 2) * scale}px`,
|
|
3363
|
-
top: `${(y - 48) * scale}px`,
|
|
3364
|
-
transform: 'translateX(-50%)'
|
|
3365
|
-
};
|
|
3366
|
-
},
|
|
3367
|
-
dragElementStyle() {
|
|
3368
|
-
if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
|
|
3369
|
-
return {};
|
|
3370
|
-
}
|
|
3371
|
-
return {
|
|
3372
|
-
opacity: 0,
|
|
3373
|
-
pointerEvents: 'none'
|
|
3374
|
-
};
|
|
3375
|
-
}
|
|
3376
|
-
},
|
|
3377
|
-
mounted() {
|
|
3378
|
-
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
3379
|
-
this.boundHandleMove = this.handleMove.bind(this);
|
|
3380
|
-
this.boundStopInteraction = this.stopInteraction.bind(this);
|
|
3381
|
-
document.addEventListener('mousedown', this.handleClickOutside);
|
|
3382
|
-
document.addEventListener('touchstart', this.handleClickOutside);
|
|
3383
|
-
},
|
|
3384
|
-
beforeUnmount() {
|
|
3385
|
-
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
3386
|
-
document.removeEventListener('touchstart', this.handleClickOutside);
|
|
3387
|
-
window.removeEventListener('mousemove', this.boundHandleMove);
|
|
3388
|
-
window.removeEventListener('mouseup', this.boundStopInteraction);
|
|
3389
|
-
window.removeEventListener('touchmove', this.boundHandleMove);
|
|
3390
|
-
window.removeEventListener('touchend', this.boundStopInteraction);
|
|
3391
|
-
if (this.rafId) cancelAnimationFrame(this.rafId);
|
|
3392
|
-
},
|
|
3393
|
-
methods: {
|
|
3394
|
-
handleElementClick(event) {
|
|
3395
|
-
if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
|
|
3396
|
-
return;
|
|
3397
|
-
}
|
|
3398
|
-
event.preventDefault();
|
|
3399
|
-
this.isSelected = true;
|
|
3400
|
-
this.startDrag(event);
|
|
3401
|
-
},
|
|
3402
|
-
handleClickOutside(event) {
|
|
3403
|
-
if (this.$el && !this.$el.contains(event.target)) {
|
|
3404
|
-
this.isSelected = false;
|
|
3405
|
-
}
|
|
3406
|
-
},
|
|
3407
|
-
startResizeFromSlot(direction, event) {
|
|
3408
|
-
if (!direction || !event) return;
|
|
3409
|
-
this.startResize(direction, event);
|
|
3410
|
-
},
|
|
3411
|
-
startDrag(event) {
|
|
3412
|
-
if (event.target.classList.contains('delete')) return;
|
|
3413
|
-
if (event.target.classList.contains('resize-handle')) return;
|
|
3414
|
-
this.mode = 'drag';
|
|
3415
|
-
this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
|
|
3416
|
-
this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
|
|
3417
|
-
this.startLeft = this.object.x;
|
|
3418
|
-
this.startTop = this.object.y;
|
|
3419
|
-
this.offsetX = 0;
|
|
3420
|
-
this.offsetY = 0;
|
|
3421
|
-
this.resetResizeOffsets();
|
|
3422
|
-
const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
|
|
3423
|
-
this.pointerOffsetDoc.x = this.startX - elementRect.left;
|
|
3424
|
-
this.pointerOffsetDoc.y = this.startY - elementRect.top;
|
|
3425
|
-
const pageRect = this.capturePageRect();
|
|
3426
|
-
this.currentPageRect = pageRect;
|
|
3427
|
-
let dragElementShift = {
|
|
3428
|
-
x: 0,
|
|
3429
|
-
y: 0
|
|
3430
|
-
};
|
|
3431
|
-
if (pageRect) {
|
|
3432
|
-
const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
|
|
3433
|
-
const expectedTop = pageRect.top + this.object.y * this.pagesScale;
|
|
3434
|
-
dragElementShift = {
|
|
3435
|
-
x: elementRect.left - expectedLeft,
|
|
3436
|
-
y: elementRect.top - expectedTop
|
|
3437
|
-
};
|
|
3438
|
-
}
|
|
3439
|
-
this.onDragStart(this.startX, this.startY, {
|
|
3440
|
-
...this.pointerOffsetDoc
|
|
3441
|
-
}, dragElementShift);
|
|
3442
|
-
window.addEventListener('mousemove', this.boundHandleMove);
|
|
3443
|
-
window.addEventListener('mouseup', this.boundStopInteraction);
|
|
3444
|
-
window.addEventListener('touchmove', this.boundHandleMove);
|
|
3445
|
-
window.addEventListener('touchend', this.boundStopInteraction);
|
|
3446
|
-
},
|
|
3447
|
-
startResize(direction, event) {
|
|
3448
|
-
this.mode = 'resize';
|
|
3449
|
-
this.direction = direction;
|
|
3450
|
-
this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
|
|
3451
|
-
this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
|
|
3452
|
-
this.startLeft = this.object.x;
|
|
3453
|
-
this.startTop = this.object.y;
|
|
3454
|
-
this.startWidth = this.object.width;
|
|
3455
|
-
this.startHeight = this.object.height;
|
|
3456
|
-
this.aspectRatio = this.startWidth / this.startHeight;
|
|
3457
|
-
this.offsetX = 0;
|
|
3458
|
-
this.offsetY = 0;
|
|
3459
|
-
this.resetResizeOffsets();
|
|
3460
|
-
window.addEventListener('mousemove', this.boundHandleMove);
|
|
3461
|
-
window.addEventListener('mouseup', this.boundStopInteraction);
|
|
3462
|
-
window.addEventListener('touchmove', this.boundHandleMove);
|
|
3463
|
-
window.addEventListener('touchend', this.boundStopInteraction);
|
|
3464
|
-
},
|
|
3465
|
-
handleMove(event) {
|
|
3466
|
-
if (this.mode === 'idle') return;
|
|
3467
|
-
event.preventDefault();
|
|
3468
|
-
if (this.rafId) return;
|
|
3469
|
-
this.rafId = requestAnimationFrame(() => {
|
|
3470
|
-
const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
|
|
3471
|
-
const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
|
|
3472
|
-
if (currentX === undefined || currentY === undefined) return;
|
|
3473
|
-
this.lastMouseX = currentX;
|
|
3474
|
-
this.lastMouseY = currentY;
|
|
3475
|
-
const deltaX = (currentX - this.startX) / this.pagesScale;
|
|
3476
|
-
const deltaY = (currentY - this.startY) / this.pagesScale;
|
|
3477
|
-
if (this.mode === 'drag') {
|
|
3478
|
-
const pageRect = this.currentPageRect;
|
|
3479
|
-
if (pageRect) {
|
|
3480
|
-
const newElementLeft = currentX - this.pointerOffsetDoc.x;
|
|
3481
|
-
const newElementTop = currentY - this.pointerOffsetDoc.y;
|
|
3482
|
-
const newX = (newElementLeft - pageRect.left) / this.pagesScale;
|
|
3483
|
-
const newY = (newElementTop - pageRect.top) / this.pagesScale;
|
|
3484
|
-
this.offsetX = newX - this.object.x;
|
|
3485
|
-
this.offsetY = newY - this.object.y;
|
|
3486
|
-
} else {
|
|
3487
|
-
this.offsetX = deltaX;
|
|
3488
|
-
this.offsetY = deltaY;
|
|
3489
|
-
}
|
|
3490
|
-
this.onDragMove(currentX, currentY);
|
|
3491
|
-
if (this.isBeingDraggedGlobally) {
|
|
3492
|
-
this.onUpdate({
|
|
3493
|
-
_globalDrag: true,
|
|
3494
|
-
_mouseX: currentX,
|
|
3495
|
-
_mouseY: currentY
|
|
3496
|
-
});
|
|
3497
|
-
}
|
|
3498
|
-
this.rafId = null;
|
|
3499
|
-
return;
|
|
3500
|
-
}
|
|
3501
|
-
const minSize = 16;
|
|
3502
|
-
let newWidth = this.startWidth;
|
|
3503
|
-
let newHeight = this.startHeight;
|
|
3504
|
-
let newLeft = this.startLeft;
|
|
3505
|
-
let newTop = this.startTop;
|
|
3506
|
-
const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
|
|
3507
|
-
newWidth = this.startWidth + widthChange;
|
|
3508
|
-
if (newWidth < minSize) newWidth = minSize;
|
|
3509
|
-
newHeight = newWidth / this.aspectRatio;
|
|
3510
|
-
if (this.direction.includes('left')) {
|
|
3511
|
-
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
3512
|
-
if (newLeft < 0) {
|
|
3513
|
-
const overflow = -newLeft;
|
|
3514
|
-
newLeft = 0;
|
|
3515
|
-
newWidth = newWidth - overflow;
|
|
3516
|
-
newHeight = newWidth / this.aspectRatio;
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
if (this.direction.includes('top')) {
|
|
3520
|
-
newTop = this.startTop + (this.startHeight - newHeight);
|
|
3521
|
-
if (newTop < 0) {
|
|
3522
|
-
const overflow = -newTop;
|
|
3523
|
-
newTop = 0;
|
|
3524
|
-
newHeight = newHeight - overflow;
|
|
3525
|
-
newWidth = newHeight * this.aspectRatio;
|
|
3526
|
-
if (this.direction.includes('left')) {
|
|
3527
|
-
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
if (newLeft + newWidth > this.pageWidth) {
|
|
3532
|
-
const excess = newLeft + newWidth - this.pageWidth;
|
|
3533
|
-
newWidth -= excess;
|
|
3534
|
-
newHeight = newWidth / this.aspectRatio;
|
|
3535
|
-
}
|
|
3536
|
-
if (newTop + newHeight > this.pageHeight) {
|
|
3537
|
-
const excess = newTop + newHeight - this.pageHeight;
|
|
3538
|
-
newHeight -= excess;
|
|
3539
|
-
newWidth = newHeight * this.aspectRatio;
|
|
3540
|
-
if (this.direction.includes('left')) {
|
|
3541
|
-
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
this.resizeOffsetX = newLeft - this.object.x;
|
|
3545
|
-
this.resizeOffsetY = newTop - this.object.y;
|
|
3546
|
-
this.resizeOffsetW = newWidth - this.object.width;
|
|
3547
|
-
this.resizeOffsetH = newHeight - this.object.height;
|
|
3548
|
-
this.rafId = null;
|
|
3549
|
-
});
|
|
3550
|
-
},
|
|
3551
|
-
stopInteraction() {
|
|
3552
|
-
if (this.mode === 'idle') return;
|
|
3553
|
-
if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
|
|
3554
|
-
if (this.isBeingDraggedGlobally) {
|
|
3555
|
-
this.onUpdate({
|
|
3556
|
-
_globalDrag: true,
|
|
3557
|
-
_mouseX: this.lastMouseX,
|
|
3558
|
-
_mouseY: this.lastMouseY
|
|
3559
|
-
});
|
|
3560
|
-
} else {
|
|
3561
|
-
const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
|
|
3562
|
-
const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
|
|
3563
|
-
this.onUpdate({
|
|
3564
|
-
x,
|
|
3565
|
-
y
|
|
3566
|
-
});
|
|
3567
|
-
}
|
|
3568
|
-
}
|
|
3569
|
-
if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
|
|
3570
|
-
const x = this.object.x + this.resizeOffsetX;
|
|
3571
|
-
const y = this.object.y + this.resizeOffsetY;
|
|
3572
|
-
const width = this.object.width + this.resizeOffsetW;
|
|
3573
|
-
const height = this.object.height + this.resizeOffsetH;
|
|
3574
|
-
this.onUpdate({
|
|
3575
|
-
x,
|
|
3576
|
-
y,
|
|
3577
|
-
width,
|
|
3578
|
-
height
|
|
3579
|
-
});
|
|
3580
|
-
}
|
|
3581
|
-
this.resetOffsets();
|
|
3582
|
-
this.onDragEnd();
|
|
3583
|
-
window.removeEventListener('mousemove', this.boundHandleMove);
|
|
3584
|
-
window.removeEventListener('mouseup', this.boundStopInteraction);
|
|
3585
|
-
window.removeEventListener('touchmove', this.boundHandleMove);
|
|
3586
|
-
window.removeEventListener('touchend', this.boundStopInteraction);
|
|
3587
|
-
},
|
|
3588
|
-
capturePageRect() {
|
|
3589
|
-
const wrapper = this.$el.closest('.page-wrapper');
|
|
3590
|
-
if (!wrapper) return null;
|
|
3591
|
-
const canvas = wrapper.querySelector('canvas');
|
|
3592
|
-
return canvas ? canvas.getBoundingClientRect() : null;
|
|
3593
|
-
},
|
|
3594
|
-
resetResizeOffsets() {
|
|
3595
|
-
this.resizeOffsetX = 0;
|
|
3596
|
-
this.resizeOffsetY = 0;
|
|
3597
|
-
this.resizeOffsetW = 0;
|
|
3598
|
-
this.resizeOffsetH = 0;
|
|
3599
|
-
},
|
|
3600
|
-
resetOffsets() {
|
|
3601
|
-
this.mode = 'idle';
|
|
3602
|
-
this.offsetX = 0;
|
|
3603
|
-
this.offsetY = 0;
|
|
3604
|
-
this.resetResizeOffsets();
|
|
3605
|
-
this.pointerOffsetDoc = {
|
|
3606
|
-
x: 0,
|
|
3607
|
-
y: 0
|
|
3608
|
-
};
|
|
3609
|
-
this.currentPageRect = null;
|
|
3610
|
-
}
|
|
3611
|
-
}
|
|
3612
|
-
});
|
|
3613
|
-
;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
|
|
3614
|
-
/* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
|
|
3615
|
-
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
|
|
3616
|
-
// extracted by mini-css-extract-plugin
|
|
3617
|
-
|
|
3618
|
-
;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
|
|
3619
|
-
|
|
3620
|
-
;// ./src/components/DraggableElement.vue
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
;
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
/* normalize component */
|
|
3628
|
-
|
|
3629
|
-
var DraggableElement_component = normalizeComponent(
|
|
3630
|
-
components_DraggableElementvue_type_script_lang_js,
|
|
3631
|
-
DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
|
|
3632
|
-
DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
|
|
3633
|
-
false,
|
|
3634
|
-
null,
|
|
3635
|
-
"55db89ce",
|
|
3636
|
-
null
|
|
3637
|
-
|
|
3638
|
-
)
|
|
3639
|
-
|
|
3640
|
-
/* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
|
|
3641
|
-
;// ./node_modules/pdfjs-dist/build/pdf.mjs
|
|
3642
|
-
/**
|
|
3643
|
-
* @licstart The following is the entire license notice for the
|
|
3644
|
-
* JavaScript code in this page
|
|
3645
|
-
*
|
|
3646
|
-
* Copyright 2024 Mozilla Foundation
|
|
3647
|
-
*
|
|
3648
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3649
|
-
* you may not use this file except in compliance with the License.
|
|
3650
|
-
* You may obtain a copy of the License at
|
|
3651
|
-
*
|
|
3652
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3653
|
-
*
|
|
3654
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3655
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3656
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3657
|
-
* See the License for the specific language governing permissions and
|
|
3658
|
-
* limitations under the License.
|
|
3659
|
-
*
|
|
3660
|
-
* @licend The above is the entire license notice for the
|
|
3661
|
-
* JavaScript code in this page
|
|
3662
|
-
*/
|
|
2775
|
+
;// ./node_modules/pdfjs-dist/build/pdf.mjs
|
|
2776
|
+
/**
|
|
2777
|
+
* @licstart The following is the entire license notice for the
|
|
2778
|
+
* JavaScript code in this page
|
|
2779
|
+
*
|
|
2780
|
+
* Copyright 2024 Mozilla Foundation
|
|
2781
|
+
*
|
|
2782
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2783
|
+
* you may not use this file except in compliance with the License.
|
|
2784
|
+
* You may obtain a copy of the License at
|
|
2785
|
+
*
|
|
2786
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2787
|
+
*
|
|
2788
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2789
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2790
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2791
|
+
* See the License for the specific language governing permissions and
|
|
2792
|
+
* limitations under the License.
|
|
2793
|
+
*
|
|
2794
|
+
* @licend The above is the entire license notice for the
|
|
2795
|
+
* JavaScript code in this page
|
|
2796
|
+
*/
|
|
3663
2797
|
|
|
3664
2798
|
/**
|
|
3665
2799
|
* pdfjsVersion = 5.4.530
|
|
@@ -15976,7 +15110,7 @@ for (const op in OPS) {
|
|
|
15976
15110
|
}
|
|
15977
15111
|
|
|
15978
15112
|
;// ./src/display/worker_options.js
|
|
15979
|
-
class
|
|
15113
|
+
class pdf_GlobalWorkerOptions {
|
|
15980
15114
|
static #port = null;
|
|
15981
15115
|
static #src = "";
|
|
15982
15116
|
static get workerPort() {
|
|
@@ -18108,7 +17242,7 @@ function getDocument(src = {}) {
|
|
|
18108
17242
|
if (!worker) {
|
|
18109
17243
|
worker = PDFWorker.create({
|
|
18110
17244
|
verbosity,
|
|
18111
|
-
port:
|
|
17245
|
+
port: pdf_GlobalWorkerOptions.workerPort
|
|
18112
17246
|
});
|
|
18113
17247
|
task._worker = worker;
|
|
18114
17248
|
}
|
|
@@ -18861,7 +17995,7 @@ class PDFWorker {
|
|
|
18861
17995
|
static {
|
|
18862
17996
|
if (isNodeJS) {
|
|
18863
17997
|
this.#isWorkerDisabled = true;
|
|
18864
|
-
|
|
17998
|
+
pdf_GlobalWorkerOptions.workerSrc ||= "./pdf.worker.mjs";
|
|
18865
17999
|
}
|
|
18866
18000
|
this._isSameOrigin = (baseUrl, otherUrl) => {
|
|
18867
18001
|
const base = URL.parse(baseUrl);
|
|
@@ -19033,8 +18167,8 @@ class PDFWorker {
|
|
|
19033
18167
|
return new PDFWorker(params);
|
|
19034
18168
|
}
|
|
19035
18169
|
static get workerSrc() {
|
|
19036
|
-
if (
|
|
19037
|
-
return
|
|
18170
|
+
if (pdf_GlobalWorkerOptions.workerSrc) {
|
|
18171
|
+
return pdf_GlobalWorkerOptions.workerSrc;
|
|
19038
18172
|
}
|
|
19039
18173
|
throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
|
|
19040
18174
|
}
|
|
@@ -29569,476 +28703,1433 @@ class AnnotationEditorLayer {
|
|
|
29569
28703
|
if (this.#currentEditorType?.isDrawer && this.#currentEditorType.supportMultipleDrawings) {
|
|
29570
28704
|
return;
|
|
29571
28705
|
}
|
|
29572
|
-
if (!this.#allowClick) {
|
|
29573
|
-
this.#allowClick = true;
|
|
29574
|
-
return;
|
|
28706
|
+
if (!this.#allowClick) {
|
|
28707
|
+
this.#allowClick = true;
|
|
28708
|
+
return;
|
|
28709
|
+
}
|
|
28710
|
+
const currentMode = this.#uiManager.getMode();
|
|
28711
|
+
if (currentMode === AnnotationEditorType.STAMP || currentMode === AnnotationEditorType.SIGNATURE) {
|
|
28712
|
+
this.#uiManager.unselectAll();
|
|
28713
|
+
return;
|
|
28714
|
+
}
|
|
28715
|
+
this.createAndAddNewEditor(event, false);
|
|
28716
|
+
}
|
|
28717
|
+
pointerdown(event) {
|
|
28718
|
+
if (this.#uiManager.getMode() === AnnotationEditorType.HIGHLIGHT) {
|
|
28719
|
+
this.enableTextSelection();
|
|
28720
|
+
}
|
|
28721
|
+
if (this.#hadPointerDown) {
|
|
28722
|
+
this.#hadPointerDown = false;
|
|
28723
|
+
return;
|
|
28724
|
+
}
|
|
28725
|
+
const {
|
|
28726
|
+
isMac
|
|
28727
|
+
} = util_FeatureTest.platform;
|
|
28728
|
+
if (event.button !== 0 || event.ctrlKey && isMac) {
|
|
28729
|
+
return;
|
|
28730
|
+
}
|
|
28731
|
+
if (event.target !== this.div) {
|
|
28732
|
+
return;
|
|
28733
|
+
}
|
|
28734
|
+
this.#hadPointerDown = true;
|
|
28735
|
+
if (this.#currentEditorType?.isDrawer) {
|
|
28736
|
+
this.startDrawingSession(event);
|
|
28737
|
+
return;
|
|
28738
|
+
}
|
|
28739
|
+
const editor = this.#uiManager.getActive();
|
|
28740
|
+
this.#allowClick = !editor || editor.isEmpty();
|
|
28741
|
+
}
|
|
28742
|
+
startDrawingSession(event) {
|
|
28743
|
+
this.div.focus({
|
|
28744
|
+
preventScroll: true
|
|
28745
|
+
});
|
|
28746
|
+
if (this.#drawingAC) {
|
|
28747
|
+
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
|
28748
|
+
return;
|
|
28749
|
+
}
|
|
28750
|
+
this.#uiManager.setCurrentDrawingSession(this);
|
|
28751
|
+
this.#drawingAC = new AbortController();
|
|
28752
|
+
const signal = this.#uiManager.combinedSignal(this.#drawingAC);
|
|
28753
|
+
this.div.addEventListener("blur", ({
|
|
28754
|
+
relatedTarget
|
|
28755
|
+
}) => {
|
|
28756
|
+
if (relatedTarget && !this.div.contains(relatedTarget)) {
|
|
28757
|
+
this.#focusedElement = null;
|
|
28758
|
+
this.commitOrRemove();
|
|
28759
|
+
}
|
|
28760
|
+
}, {
|
|
28761
|
+
signal
|
|
28762
|
+
});
|
|
28763
|
+
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
|
28764
|
+
}
|
|
28765
|
+
pause(on) {
|
|
28766
|
+
if (on) {
|
|
28767
|
+
const {
|
|
28768
|
+
activeElement
|
|
28769
|
+
} = document;
|
|
28770
|
+
if (this.div.contains(activeElement)) {
|
|
28771
|
+
this.#focusedElement = activeElement;
|
|
28772
|
+
}
|
|
28773
|
+
return;
|
|
28774
|
+
}
|
|
28775
|
+
if (this.#focusedElement) {
|
|
28776
|
+
setTimeout(() => {
|
|
28777
|
+
this.#focusedElement?.focus();
|
|
28778
|
+
this.#focusedElement = null;
|
|
28779
|
+
}, 0);
|
|
28780
|
+
}
|
|
28781
|
+
}
|
|
28782
|
+
endDrawingSession(isAborted = false) {
|
|
28783
|
+
if (!this.#drawingAC) {
|
|
28784
|
+
return null;
|
|
28785
|
+
}
|
|
28786
|
+
this.#uiManager.setCurrentDrawingSession(null);
|
|
28787
|
+
this.#drawingAC.abort();
|
|
28788
|
+
this.#drawingAC = null;
|
|
28789
|
+
this.#focusedElement = null;
|
|
28790
|
+
return this.#currentEditorType.endDrawing(isAborted);
|
|
28791
|
+
}
|
|
28792
|
+
findNewParent(editor, x, y) {
|
|
28793
|
+
const layer = this.#uiManager.findParent(x, y);
|
|
28794
|
+
if (layer === null || layer === this) {
|
|
28795
|
+
return false;
|
|
28796
|
+
}
|
|
28797
|
+
layer.changeParent(editor);
|
|
28798
|
+
return true;
|
|
28799
|
+
}
|
|
28800
|
+
commitOrRemove() {
|
|
28801
|
+
if (this.#drawingAC) {
|
|
28802
|
+
this.endDrawingSession();
|
|
28803
|
+
return true;
|
|
28804
|
+
}
|
|
28805
|
+
return false;
|
|
28806
|
+
}
|
|
28807
|
+
onScaleChanging() {
|
|
28808
|
+
if (!this.#drawingAC) {
|
|
28809
|
+
return;
|
|
28810
|
+
}
|
|
28811
|
+
this.#currentEditorType.onScaleChangingWhenDrawing(this);
|
|
28812
|
+
}
|
|
28813
|
+
destroy() {
|
|
28814
|
+
this.commitOrRemove();
|
|
28815
|
+
if (this.#uiManager.getActive()?.parent === this) {
|
|
28816
|
+
this.#uiManager.commitOrRemove();
|
|
28817
|
+
this.#uiManager.setActiveEditor(null);
|
|
28818
|
+
}
|
|
28819
|
+
if (this.#editorFocusTimeoutId) {
|
|
28820
|
+
clearTimeout(this.#editorFocusTimeoutId);
|
|
28821
|
+
this.#editorFocusTimeoutId = null;
|
|
28822
|
+
}
|
|
28823
|
+
for (const editor of this.#editors.values()) {
|
|
28824
|
+
this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
|
|
28825
|
+
editor.setParent(null);
|
|
28826
|
+
editor.isAttachedToDOM = false;
|
|
28827
|
+
editor.div.remove();
|
|
28828
|
+
}
|
|
28829
|
+
this.div = null;
|
|
28830
|
+
this.#editors.clear();
|
|
28831
|
+
this.#uiManager.removeLayer(this);
|
|
28832
|
+
}
|
|
28833
|
+
#cleanup() {
|
|
28834
|
+
for (const editor of this.#editors.values()) {
|
|
28835
|
+
if (editor.isEmpty()) {
|
|
28836
|
+
editor.remove();
|
|
28837
|
+
}
|
|
28838
|
+
}
|
|
28839
|
+
}
|
|
28840
|
+
render({
|
|
28841
|
+
viewport
|
|
28842
|
+
}) {
|
|
28843
|
+
this.viewport = viewport;
|
|
28844
|
+
setLayerDimensions(this.div, viewport);
|
|
28845
|
+
for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
|
|
28846
|
+
this.add(editor);
|
|
28847
|
+
editor.rebuild();
|
|
28848
|
+
}
|
|
28849
|
+
this.updateMode();
|
|
28850
|
+
}
|
|
28851
|
+
update({
|
|
28852
|
+
viewport
|
|
28853
|
+
}) {
|
|
28854
|
+
this.#uiManager.commitOrRemove();
|
|
28855
|
+
this.#cleanup();
|
|
28856
|
+
const oldRotation = this.viewport.rotation;
|
|
28857
|
+
const rotation = viewport.rotation;
|
|
28858
|
+
this.viewport = viewport;
|
|
28859
|
+
setLayerDimensions(this.div, {
|
|
28860
|
+
rotation
|
|
28861
|
+
});
|
|
28862
|
+
if (oldRotation !== rotation) {
|
|
28863
|
+
for (const editor of this.#editors.values()) {
|
|
28864
|
+
editor.rotate(rotation);
|
|
28865
|
+
}
|
|
28866
|
+
}
|
|
28867
|
+
}
|
|
28868
|
+
get pageDimensions() {
|
|
28869
|
+
const {
|
|
28870
|
+
pageWidth,
|
|
28871
|
+
pageHeight
|
|
28872
|
+
} = this.viewport.rawDims;
|
|
28873
|
+
return [pageWidth, pageHeight];
|
|
28874
|
+
}
|
|
28875
|
+
get scale() {
|
|
28876
|
+
return this.#uiManager.viewParameters.realScale;
|
|
28877
|
+
}
|
|
28878
|
+
}
|
|
28879
|
+
|
|
28880
|
+
;// ./src/display/draw_layer.js
|
|
28881
|
+
|
|
28882
|
+
|
|
28883
|
+
class DrawLayer {
|
|
28884
|
+
#parent = null;
|
|
28885
|
+
#mapping = new Map();
|
|
28886
|
+
#toUpdate = new Map();
|
|
28887
|
+
static #id = 0;
|
|
28888
|
+
constructor({
|
|
28889
|
+
pageIndex
|
|
28890
|
+
}) {
|
|
28891
|
+
this.pageIndex = pageIndex;
|
|
28892
|
+
}
|
|
28893
|
+
setParent(parent) {
|
|
28894
|
+
if (!this.#parent) {
|
|
28895
|
+
this.#parent = parent;
|
|
28896
|
+
return;
|
|
28897
|
+
}
|
|
28898
|
+
if (this.#parent !== parent) {
|
|
28899
|
+
if (this.#mapping.size > 0) {
|
|
28900
|
+
for (const root of this.#mapping.values()) {
|
|
28901
|
+
root.remove();
|
|
28902
|
+
parent.append(root);
|
|
28903
|
+
}
|
|
28904
|
+
}
|
|
28905
|
+
this.#parent = parent;
|
|
28906
|
+
}
|
|
28907
|
+
}
|
|
28908
|
+
static get _svgFactory() {
|
|
28909
|
+
return shadow(this, "_svgFactory", new DOMSVGFactory());
|
|
28910
|
+
}
|
|
28911
|
+
static #setBox(element, [x, y, width, height]) {
|
|
28912
|
+
const {
|
|
28913
|
+
style
|
|
28914
|
+
} = element;
|
|
28915
|
+
style.top = `${100 * y}%`;
|
|
28916
|
+
style.left = `${100 * x}%`;
|
|
28917
|
+
style.width = `${100 * width}%`;
|
|
28918
|
+
style.height = `${100 * height}%`;
|
|
28919
|
+
}
|
|
28920
|
+
#createSVG() {
|
|
28921
|
+
const svg = DrawLayer._svgFactory.create(1, 1, true);
|
|
28922
|
+
this.#parent.append(svg);
|
|
28923
|
+
svg.setAttribute("aria-hidden", true);
|
|
28924
|
+
return svg;
|
|
28925
|
+
}
|
|
28926
|
+
#createClipPath(defs, pathId) {
|
|
28927
|
+
const clipPath = DrawLayer._svgFactory.createElement("clipPath");
|
|
28928
|
+
defs.append(clipPath);
|
|
28929
|
+
const clipPathId = `clip_${pathId}`;
|
|
28930
|
+
clipPath.setAttribute("id", clipPathId);
|
|
28931
|
+
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
|
28932
|
+
const clipPathUse = DrawLayer._svgFactory.createElement("use");
|
|
28933
|
+
clipPath.append(clipPathUse);
|
|
28934
|
+
clipPathUse.setAttribute("href", `#${pathId}`);
|
|
28935
|
+
clipPathUse.classList.add("clip");
|
|
28936
|
+
return clipPathId;
|
|
28937
|
+
}
|
|
28938
|
+
#updateProperties(element, properties) {
|
|
28939
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
28940
|
+
if (value === null) {
|
|
28941
|
+
element.removeAttribute(key);
|
|
28942
|
+
} else {
|
|
28943
|
+
element.setAttribute(key, value);
|
|
28944
|
+
}
|
|
28945
|
+
}
|
|
28946
|
+
}
|
|
28947
|
+
draw(properties, isPathUpdatable = false, hasClip = false) {
|
|
28948
|
+
const id = DrawLayer.#id++;
|
|
28949
|
+
const root = this.#createSVG();
|
|
28950
|
+
const defs = DrawLayer._svgFactory.createElement("defs");
|
|
28951
|
+
root.append(defs);
|
|
28952
|
+
const path = DrawLayer._svgFactory.createElement("path");
|
|
28953
|
+
defs.append(path);
|
|
28954
|
+
const pathId = `path_p${this.pageIndex}_${id}`;
|
|
28955
|
+
path.setAttribute("id", pathId);
|
|
28956
|
+
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
28957
|
+
if (isPathUpdatable) {
|
|
28958
|
+
this.#toUpdate.set(id, path);
|
|
28959
|
+
}
|
|
28960
|
+
const clipPathId = hasClip ? this.#createClipPath(defs, pathId) : null;
|
|
28961
|
+
const use = DrawLayer._svgFactory.createElement("use");
|
|
28962
|
+
root.append(use);
|
|
28963
|
+
use.setAttribute("href", `#${pathId}`);
|
|
28964
|
+
this.updateProperties(root, properties);
|
|
28965
|
+
this.#mapping.set(id, root);
|
|
28966
|
+
return {
|
|
28967
|
+
id,
|
|
28968
|
+
clipPathId: `url(#${clipPathId})`
|
|
28969
|
+
};
|
|
28970
|
+
}
|
|
28971
|
+
drawOutline(properties, mustRemoveSelfIntersections) {
|
|
28972
|
+
const id = DrawLayer.#id++;
|
|
28973
|
+
const root = this.#createSVG();
|
|
28974
|
+
const defs = DrawLayer._svgFactory.createElement("defs");
|
|
28975
|
+
root.append(defs);
|
|
28976
|
+
const path = DrawLayer._svgFactory.createElement("path");
|
|
28977
|
+
defs.append(path);
|
|
28978
|
+
const pathId = `path_p${this.pageIndex}_${id}`;
|
|
28979
|
+
path.setAttribute("id", pathId);
|
|
28980
|
+
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
28981
|
+
let maskId;
|
|
28982
|
+
if (mustRemoveSelfIntersections) {
|
|
28983
|
+
const mask = DrawLayer._svgFactory.createElement("mask");
|
|
28984
|
+
defs.append(mask);
|
|
28985
|
+
maskId = `mask_p${this.pageIndex}_${id}`;
|
|
28986
|
+
mask.setAttribute("id", maskId);
|
|
28987
|
+
mask.setAttribute("maskUnits", "objectBoundingBox");
|
|
28988
|
+
const rect = DrawLayer._svgFactory.createElement("rect");
|
|
28989
|
+
mask.append(rect);
|
|
28990
|
+
rect.setAttribute("width", "1");
|
|
28991
|
+
rect.setAttribute("height", "1");
|
|
28992
|
+
rect.setAttribute("fill", "white");
|
|
28993
|
+
const use = DrawLayer._svgFactory.createElement("use");
|
|
28994
|
+
mask.append(use);
|
|
28995
|
+
use.setAttribute("href", `#${pathId}`);
|
|
28996
|
+
use.setAttribute("stroke", "none");
|
|
28997
|
+
use.setAttribute("fill", "black");
|
|
28998
|
+
use.setAttribute("fill-rule", "nonzero");
|
|
28999
|
+
use.classList.add("mask");
|
|
29575
29000
|
}
|
|
29576
|
-
const
|
|
29577
|
-
|
|
29578
|
-
|
|
29579
|
-
|
|
29001
|
+
const use1 = DrawLayer._svgFactory.createElement("use");
|
|
29002
|
+
root.append(use1);
|
|
29003
|
+
use1.setAttribute("href", `#${pathId}`);
|
|
29004
|
+
if (maskId) {
|
|
29005
|
+
use1.setAttribute("mask", `url(#${maskId})`);
|
|
29580
29006
|
}
|
|
29581
|
-
|
|
29007
|
+
const use2 = use1.cloneNode();
|
|
29008
|
+
root.append(use2);
|
|
29009
|
+
use1.classList.add("mainOutline");
|
|
29010
|
+
use2.classList.add("secondaryOutline");
|
|
29011
|
+
this.updateProperties(root, properties);
|
|
29012
|
+
this.#mapping.set(id, root);
|
|
29013
|
+
return id;
|
|
29582
29014
|
}
|
|
29583
|
-
|
|
29584
|
-
|
|
29585
|
-
|
|
29586
|
-
|
|
29587
|
-
|
|
29588
|
-
|
|
29015
|
+
finalizeDraw(id, properties) {
|
|
29016
|
+
this.#toUpdate.delete(id);
|
|
29017
|
+
this.updateProperties(id, properties);
|
|
29018
|
+
}
|
|
29019
|
+
updateProperties(elementOrId, properties) {
|
|
29020
|
+
if (!properties) {
|
|
29589
29021
|
return;
|
|
29590
29022
|
}
|
|
29591
29023
|
const {
|
|
29592
|
-
|
|
29593
|
-
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
}
|
|
29597
|
-
|
|
29024
|
+
root,
|
|
29025
|
+
bbox,
|
|
29026
|
+
rootClass,
|
|
29027
|
+
path
|
|
29028
|
+
} = properties;
|
|
29029
|
+
const element = typeof elementOrId === "number" ? this.#mapping.get(elementOrId) : elementOrId;
|
|
29030
|
+
if (!element) {
|
|
29598
29031
|
return;
|
|
29599
29032
|
}
|
|
29600
|
-
|
|
29601
|
-
|
|
29602
|
-
this.startDrawingSession(event);
|
|
29603
|
-
return;
|
|
29033
|
+
if (root) {
|
|
29034
|
+
this.#updateProperties(element, root);
|
|
29604
29035
|
}
|
|
29605
|
-
|
|
29606
|
-
|
|
29607
|
-
}
|
|
29608
|
-
startDrawingSession(event) {
|
|
29609
|
-
this.div.focus({
|
|
29610
|
-
preventScroll: true
|
|
29611
|
-
});
|
|
29612
|
-
if (this.#drawingAC) {
|
|
29613
|
-
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
|
29614
|
-
return;
|
|
29036
|
+
if (bbox) {
|
|
29037
|
+
DrawLayer.#setBox(element, bbox);
|
|
29615
29038
|
}
|
|
29616
|
-
|
|
29617
|
-
this.#drawingAC = new AbortController();
|
|
29618
|
-
const signal = this.#uiManager.combinedSignal(this.#drawingAC);
|
|
29619
|
-
this.div.addEventListener("blur", ({
|
|
29620
|
-
relatedTarget
|
|
29621
|
-
}) => {
|
|
29622
|
-
if (relatedTarget && !this.div.contains(relatedTarget)) {
|
|
29623
|
-
this.#focusedElement = null;
|
|
29624
|
-
this.commitOrRemove();
|
|
29625
|
-
}
|
|
29626
|
-
}, {
|
|
29627
|
-
signal
|
|
29628
|
-
});
|
|
29629
|
-
this.#currentEditorType.startDrawing(this, this.#uiManager, false, event);
|
|
29630
|
-
}
|
|
29631
|
-
pause(on) {
|
|
29632
|
-
if (on) {
|
|
29039
|
+
if (rootClass) {
|
|
29633
29040
|
const {
|
|
29634
|
-
|
|
29635
|
-
} =
|
|
29636
|
-
|
|
29637
|
-
|
|
29041
|
+
classList
|
|
29042
|
+
} = element;
|
|
29043
|
+
for (const [className, value] of Object.entries(rootClass)) {
|
|
29044
|
+
classList.toggle(className, value);
|
|
29638
29045
|
}
|
|
29639
|
-
return;
|
|
29640
29046
|
}
|
|
29641
|
-
if (
|
|
29642
|
-
|
|
29643
|
-
|
|
29644
|
-
|
|
29645
|
-
}, 0);
|
|
29047
|
+
if (path) {
|
|
29048
|
+
const defs = element.firstElementChild;
|
|
29049
|
+
const pathElement = defs.firstElementChild;
|
|
29050
|
+
this.#updateProperties(pathElement, path);
|
|
29646
29051
|
}
|
|
29647
29052
|
}
|
|
29648
|
-
|
|
29649
|
-
if (
|
|
29650
|
-
return
|
|
29053
|
+
updateParent(id, layer) {
|
|
29054
|
+
if (layer === this) {
|
|
29055
|
+
return;
|
|
29651
29056
|
}
|
|
29652
|
-
this.#
|
|
29653
|
-
|
|
29654
|
-
|
|
29655
|
-
|
|
29656
|
-
|
|
29057
|
+
const root = this.#mapping.get(id);
|
|
29058
|
+
if (!root) {
|
|
29059
|
+
return;
|
|
29060
|
+
}
|
|
29061
|
+
layer.#parent.append(root);
|
|
29062
|
+
this.#mapping.delete(id);
|
|
29063
|
+
layer.#mapping.set(id, root);
|
|
29657
29064
|
}
|
|
29658
|
-
|
|
29659
|
-
|
|
29660
|
-
if (
|
|
29661
|
-
return
|
|
29065
|
+
remove(id) {
|
|
29066
|
+
this.#toUpdate.delete(id);
|
|
29067
|
+
if (this.#parent === null) {
|
|
29068
|
+
return;
|
|
29662
29069
|
}
|
|
29663
|
-
|
|
29664
|
-
|
|
29070
|
+
this.#mapping.get(id).remove();
|
|
29071
|
+
this.#mapping.delete(id);
|
|
29665
29072
|
}
|
|
29666
|
-
|
|
29667
|
-
|
|
29668
|
-
|
|
29669
|
-
|
|
29073
|
+
destroy() {
|
|
29074
|
+
this.#parent = null;
|
|
29075
|
+
for (const root of this.#mapping.values()) {
|
|
29076
|
+
root.remove();
|
|
29670
29077
|
}
|
|
29671
|
-
|
|
29078
|
+
this.#mapping.clear();
|
|
29079
|
+
this.#toUpdate.clear();
|
|
29672
29080
|
}
|
|
29673
|
-
|
|
29674
|
-
|
|
29675
|
-
|
|
29081
|
+
}
|
|
29082
|
+
|
|
29083
|
+
;// ./src/pdf.js
|
|
29084
|
+
|
|
29085
|
+
|
|
29086
|
+
|
|
29087
|
+
|
|
29088
|
+
|
|
29089
|
+
|
|
29090
|
+
|
|
29091
|
+
|
|
29092
|
+
|
|
29093
|
+
|
|
29094
|
+
|
|
29095
|
+
|
|
29096
|
+
|
|
29097
|
+
|
|
29098
|
+
|
|
29099
|
+
|
|
29100
|
+
{
|
|
29101
|
+
globalThis._pdfjsTestingUtils = {
|
|
29102
|
+
HighlightOutliner: HighlightOutliner
|
|
29103
|
+
};
|
|
29104
|
+
}
|
|
29105
|
+
globalThis.pdfjsLib = {
|
|
29106
|
+
AbortException: AbortException,
|
|
29107
|
+
AnnotationEditorLayer: AnnotationEditorLayer,
|
|
29108
|
+
AnnotationEditorParamsType: AnnotationEditorParamsType,
|
|
29109
|
+
AnnotationEditorType: AnnotationEditorType,
|
|
29110
|
+
AnnotationEditorUIManager: AnnotationEditorUIManager,
|
|
29111
|
+
AnnotationLayer: AnnotationLayer,
|
|
29112
|
+
AnnotationMode: AnnotationMode,
|
|
29113
|
+
AnnotationType: AnnotationType,
|
|
29114
|
+
applyOpacity: applyOpacity,
|
|
29115
|
+
build: build,
|
|
29116
|
+
ColorPicker: ColorPicker,
|
|
29117
|
+
createValidAbsoluteUrl: createValidAbsoluteUrl,
|
|
29118
|
+
CSSConstants: CSSConstants,
|
|
29119
|
+
DOMSVGFactory: DOMSVGFactory,
|
|
29120
|
+
DrawLayer: DrawLayer,
|
|
29121
|
+
FeatureTest: util_FeatureTest,
|
|
29122
|
+
fetchData: fetchData,
|
|
29123
|
+
findContrastColor: findContrastColor,
|
|
29124
|
+
getDocument: getDocument,
|
|
29125
|
+
getFilenameFromUrl: getFilenameFromUrl,
|
|
29126
|
+
getPdfFilenameFromUrl: getPdfFilenameFromUrl,
|
|
29127
|
+
getRGB: getRGB,
|
|
29128
|
+
getUuid: getUuid,
|
|
29129
|
+
getXfaPageViewport: getXfaPageViewport,
|
|
29130
|
+
GlobalWorkerOptions: pdf_GlobalWorkerOptions,
|
|
29131
|
+
ImageKind: util_ImageKind,
|
|
29132
|
+
InvalidPDFException: InvalidPDFException,
|
|
29133
|
+
isDataScheme: isDataScheme,
|
|
29134
|
+
isPdfFile: isPdfFile,
|
|
29135
|
+
isValidExplicitDest: isValidExplicitDest,
|
|
29136
|
+
MathClamp: MathClamp,
|
|
29137
|
+
noContextMenu: noContextMenu,
|
|
29138
|
+
normalizeUnicode: normalizeUnicode,
|
|
29139
|
+
OPS: OPS,
|
|
29140
|
+
OutputScale: OutputScale,
|
|
29141
|
+
PasswordResponses: PasswordResponses,
|
|
29142
|
+
PDFDataRangeTransport: PDFDataRangeTransport,
|
|
29143
|
+
PDFDateString: PDFDateString,
|
|
29144
|
+
PDFWorker: PDFWorker,
|
|
29145
|
+
PermissionFlag: PermissionFlag,
|
|
29146
|
+
PixelsPerInch: PixelsPerInch,
|
|
29147
|
+
RenderingCancelledException: RenderingCancelledException,
|
|
29148
|
+
renderRichText: renderRichText,
|
|
29149
|
+
ResponseException: ResponseException,
|
|
29150
|
+
setLayerDimensions: setLayerDimensions,
|
|
29151
|
+
shadow: shadow,
|
|
29152
|
+
SignatureExtractor: SignatureExtractor,
|
|
29153
|
+
stopEvent: stopEvent,
|
|
29154
|
+
SupportedImageMimeTypes: SupportedImageMimeTypes,
|
|
29155
|
+
TextLayer: TextLayer,
|
|
29156
|
+
TouchManager: TouchManager,
|
|
29157
|
+
updateUrlHash: updateUrlHash,
|
|
29158
|
+
Util: Util,
|
|
29159
|
+
VerbosityLevel: VerbosityLevel,
|
|
29160
|
+
version: version,
|
|
29161
|
+
XfaLayer: XfaLayer
|
|
29162
|
+
};
|
|
29163
|
+
|
|
29164
|
+
|
|
29165
|
+
|
|
29166
|
+
//# sourceMappingURL=pdf.mjs.map
|
|
29167
|
+
;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
|
|
29168
|
+
const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
|
|
29169
|
+
;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=template&id=ddd8aa14&scoped=true
|
|
29170
|
+
var render = function render() {
|
|
29171
|
+
var _vm = this,
|
|
29172
|
+
_c = _vm._self._c;
|
|
29173
|
+
return _c('div', {
|
|
29174
|
+
staticClass: "pdf-elements-root",
|
|
29175
|
+
style: {
|
|
29176
|
+
width: _vm.width,
|
|
29177
|
+
height: _vm.height
|
|
29676
29178
|
}
|
|
29677
|
-
|
|
29678
|
-
|
|
29679
|
-
|
|
29680
|
-
|
|
29681
|
-
|
|
29682
|
-
this.#uiManager.commitOrRemove();
|
|
29683
|
-
this.#uiManager.setActiveEditor(null);
|
|
29179
|
+
}, [_vm.pdfDocuments.length ? _c('div', {
|
|
29180
|
+
staticClass: "pages-container",
|
|
29181
|
+
style: {
|
|
29182
|
+
transform: `scale(${_vm.visualScale / _vm.scale})`,
|
|
29183
|
+
transformOrigin: 'top center'
|
|
29684
29184
|
}
|
|
29685
|
-
|
|
29686
|
-
|
|
29687
|
-
|
|
29185
|
+
}, _vm._l(_vm.pdfDocuments, function (pdfDoc, docIndex) {
|
|
29186
|
+
return _c('div', {
|
|
29187
|
+
key: docIndex
|
|
29188
|
+
}, _vm._l(pdfDoc.pages, function (page, pIndex) {
|
|
29189
|
+
return _c('div', {
|
|
29190
|
+
key: `${docIndex}-${pIndex}`,
|
|
29191
|
+
staticClass: "page-slot"
|
|
29192
|
+
}, [_c('div', {
|
|
29193
|
+
staticClass: "page-wrapper",
|
|
29194
|
+
on: {
|
|
29195
|
+
"mousedown": function ($event) {
|
|
29196
|
+
return _vm.selectPage(docIndex, pIndex);
|
|
29197
|
+
},
|
|
29198
|
+
"touchstart": function ($event) {
|
|
29199
|
+
return _vm.selectPage(docIndex, pIndex);
|
|
29200
|
+
}
|
|
29201
|
+
}
|
|
29202
|
+
}, [_c('div', {
|
|
29203
|
+
staticClass: "page-canvas",
|
|
29204
|
+
class: {
|
|
29205
|
+
'shadow-outline': docIndex === _vm.selectedDocIndex && pIndex === _vm.selectedPageIndex
|
|
29206
|
+
}
|
|
29207
|
+
}, [_c('PDFPage', {
|
|
29208
|
+
ref: `page${docIndex}-${pIndex}`,
|
|
29209
|
+
refInFor: true,
|
|
29210
|
+
attrs: {
|
|
29211
|
+
"page": page,
|
|
29212
|
+
"scale": _vm.scale
|
|
29213
|
+
},
|
|
29214
|
+
on: {
|
|
29215
|
+
"onMeasure": function ($event) {
|
|
29216
|
+
return _vm.onMeasure($event, docIndex, pIndex);
|
|
29217
|
+
}
|
|
29218
|
+
}
|
|
29219
|
+
}), _c('div', {
|
|
29220
|
+
staticClass: "overlay"
|
|
29221
|
+
}, [_vm.isAddingMode && _vm.previewPageDocIndex === docIndex && _vm.previewPageIndex === pIndex && _vm.previewElement && _vm.previewVisible ? _c('div', {
|
|
29222
|
+
staticClass: "preview-element",
|
|
29223
|
+
style: {
|
|
29224
|
+
left: `${_vm.previewPosition.x * _vm.previewScale.x}px`,
|
|
29225
|
+
top: `${_vm.previewPosition.y * _vm.previewScale.y}px`,
|
|
29226
|
+
width: `${_vm.previewElement.width * _vm.previewScale.x}px`,
|
|
29227
|
+
height: `${_vm.previewElement.height * _vm.previewScale.y}px`
|
|
29228
|
+
}
|
|
29229
|
+
}, [_vm._t("custom", null, {
|
|
29230
|
+
"object": _vm.previewElement,
|
|
29231
|
+
"isSelected": false
|
|
29232
|
+
})], 2) : _vm._e(), _vm._l(pdfDoc.allObjects[pIndex], function (object) {
|
|
29233
|
+
return _c('DraggableElement', {
|
|
29234
|
+
key: object.id,
|
|
29235
|
+
ref: `draggable${docIndex}-${pIndex}-${object.id}`,
|
|
29236
|
+
refInFor: true,
|
|
29237
|
+
attrs: {
|
|
29238
|
+
"object": object,
|
|
29239
|
+
"pages-scale": _vm.getRenderPageScale(docIndex, pIndex),
|
|
29240
|
+
"page-width": _vm.getPageWidth(docIndex, pIndex),
|
|
29241
|
+
"page-height": _vm.getPageHeight(docIndex, pIndex),
|
|
29242
|
+
"on-update": payload => _vm.updateObject(docIndex, object.id, payload),
|
|
29243
|
+
"on-delete": () => _vm.deleteObject(docIndex, object.id),
|
|
29244
|
+
"on-drag-start": (mouseX, mouseY, pointerOffset, dragShift) => _vm.startDraggingElement(docIndex, pIndex, object, mouseX, mouseY, pointerOffset, dragShift),
|
|
29245
|
+
"on-drag-move": _vm.updateDraggingPosition,
|
|
29246
|
+
"on-drag-end": _vm.stopDraggingElement,
|
|
29247
|
+
"is-being-dragged-globally": _vm.isDraggingElement && _vm.draggingObject && _vm.draggingObject.id === object.id,
|
|
29248
|
+
"dragging-client-pos": _vm.draggingClientPosition,
|
|
29249
|
+
"current-doc-index": docIndex,
|
|
29250
|
+
"current-page-index": pIndex,
|
|
29251
|
+
"global-drag-doc-index": _vm.draggingDocIndex,
|
|
29252
|
+
"global-drag-page-index": _vm.draggingPageIndex,
|
|
29253
|
+
"show-selection-ui": _vm.showSelectionHandles && !_vm.hideSelectionUI && object.resizable !== false,
|
|
29254
|
+
"show-default-actions": _vm.showElementActions && !_vm.hideSelectionUI
|
|
29255
|
+
},
|
|
29256
|
+
scopedSlots: _vm._u([{
|
|
29257
|
+
key: "default",
|
|
29258
|
+
fn: function (slotProps) {
|
|
29259
|
+
return [_vm._t(slotProps.object.type ? `element-${slotProps.object.type}` : 'custom', function () {
|
|
29260
|
+
return [_vm._t("custom", null, {
|
|
29261
|
+
"object": slotProps.object,
|
|
29262
|
+
"onDelete": slotProps.onDelete,
|
|
29263
|
+
"onResize": slotProps.onResize
|
|
29264
|
+
})];
|
|
29265
|
+
}, {
|
|
29266
|
+
"object": slotProps.object,
|
|
29267
|
+
"onDelete": slotProps.onDelete,
|
|
29268
|
+
"onResize": slotProps.onResize
|
|
29269
|
+
})];
|
|
29270
|
+
}
|
|
29271
|
+
}, {
|
|
29272
|
+
key: "actions",
|
|
29273
|
+
fn: function (slotProps) {
|
|
29274
|
+
return [_vm._t("actions", null, {
|
|
29275
|
+
"object": slotProps.object,
|
|
29276
|
+
"onDelete": slotProps.onDelete
|
|
29277
|
+
})];
|
|
29278
|
+
}
|
|
29279
|
+
}], null, true)
|
|
29280
|
+
});
|
|
29281
|
+
})], 2)], 1), _vm.showPageFooter ? _c('div', {
|
|
29282
|
+
staticClass: "page-footer"
|
|
29283
|
+
}, [_c('span', [_vm._v(_vm._s(pdfDoc.name))]), _c('span', [_vm._v(_vm._s(_vm.formatPageNumber(pIndex + 1, pdfDoc.numPages)))])]) : _vm._e()])]);
|
|
29284
|
+
}), 0);
|
|
29285
|
+
}), 0) : _vm._e(), _vm.isDraggingElement && _vm.draggingObject ? _c('div', {
|
|
29286
|
+
staticClass: "drag-portal",
|
|
29287
|
+
style: {
|
|
29288
|
+
position: 'fixed',
|
|
29289
|
+
left: `${_vm.draggingClientPosition.x}px`,
|
|
29290
|
+
top: `${_vm.draggingClientPosition.y}px`,
|
|
29291
|
+
width: `${_vm.draggingObject.width * _vm.draggingScale}px`,
|
|
29292
|
+
height: `${_vm.draggingObject.height * _vm.draggingScale}px`,
|
|
29293
|
+
pointerEvents: 'none'
|
|
29688
29294
|
}
|
|
29689
|
-
|
|
29690
|
-
|
|
29691
|
-
|
|
29692
|
-
|
|
29693
|
-
|
|
29295
|
+
}, [_vm._t(_vm.draggingObject.type ? `element-${_vm.draggingObject.type}` : 'custom', function () {
|
|
29296
|
+
return [_vm._t("custom", null, {
|
|
29297
|
+
"object": _vm.draggingObject,
|
|
29298
|
+
"isSelected": false
|
|
29299
|
+
})];
|
|
29300
|
+
}, {
|
|
29301
|
+
"object": _vm.draggingObject,
|
|
29302
|
+
"isSelected": false
|
|
29303
|
+
})], 2) : _vm._e()]);
|
|
29304
|
+
};
|
|
29305
|
+
var staticRenderFns = [];
|
|
29306
|
+
|
|
29307
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
29308
|
+
var es_array_push = __webpack_require__(4114);
|
|
29309
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
|
|
29310
|
+
var es_iterator_constructor = __webpack_require__(8111);
|
|
29311
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
|
29312
|
+
var es_iterator_filter = __webpack_require__(2489);
|
|
29313
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
|
|
29314
|
+
var es_iterator_find = __webpack_require__(116);
|
|
29315
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js
|
|
29316
|
+
var es_iterator_flat_map = __webpack_require__(531);
|
|
29317
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
|
29318
|
+
var es_iterator_for_each = __webpack_require__(7588);
|
|
29319
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
|
|
29320
|
+
var es_iterator_map = __webpack_require__(1701);
|
|
29321
|
+
;// ./node_modules/debounce/index.js
|
|
29322
|
+
function debounce(function_, wait = 100, options = {}) {
|
|
29323
|
+
if (typeof function_ !== 'function') {
|
|
29324
|
+
throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
|
|
29325
|
+
}
|
|
29326
|
+
|
|
29327
|
+
if (wait < 0) {
|
|
29328
|
+
throw new RangeError('`wait` must not be negative.');
|
|
29329
|
+
}
|
|
29330
|
+
|
|
29331
|
+
if (typeof options === 'boolean') {
|
|
29332
|
+
throw new TypeError('The `options` parameter must be an object, not a boolean. Use `{immediate: true}` instead.');
|
|
29333
|
+
}
|
|
29334
|
+
|
|
29335
|
+
const {immediate} = options;
|
|
29336
|
+
|
|
29337
|
+
let storedContext;
|
|
29338
|
+
let storedArguments;
|
|
29339
|
+
let timeoutId;
|
|
29340
|
+
let timestamp;
|
|
29341
|
+
let result;
|
|
29342
|
+
|
|
29343
|
+
function run() {
|
|
29344
|
+
const callContext = storedContext;
|
|
29345
|
+
const callArguments = storedArguments;
|
|
29346
|
+
storedContext = undefined;
|
|
29347
|
+
storedArguments = undefined;
|
|
29348
|
+
result = function_.apply(callContext, callArguments);
|
|
29349
|
+
return result;
|
|
29350
|
+
}
|
|
29351
|
+
|
|
29352
|
+
function later() {
|
|
29353
|
+
const last = Date.now() - timestamp;
|
|
29354
|
+
|
|
29355
|
+
if (last < wait && last >= 0) {
|
|
29356
|
+
timeoutId = setTimeout(later, wait - last);
|
|
29357
|
+
} else {
|
|
29358
|
+
timeoutId = undefined;
|
|
29359
|
+
|
|
29360
|
+
if (!immediate) {
|
|
29361
|
+
result = run();
|
|
29362
|
+
}
|
|
29363
|
+
}
|
|
29364
|
+
}
|
|
29365
|
+
|
|
29366
|
+
const debounced = function (...arguments_) {
|
|
29367
|
+
if (
|
|
29368
|
+
storedContext
|
|
29369
|
+
&& this !== storedContext
|
|
29370
|
+
&& Object.getPrototypeOf(this) === Object.getPrototypeOf(storedContext)
|
|
29371
|
+
) {
|
|
29372
|
+
throw new Error('Debounced method called with different contexts of the same prototype.');
|
|
29373
|
+
}
|
|
29374
|
+
|
|
29375
|
+
storedContext = this; // eslint-disable-line unicorn/no-this-assignment
|
|
29376
|
+
storedArguments = arguments_;
|
|
29377
|
+
timestamp = Date.now();
|
|
29378
|
+
|
|
29379
|
+
const callNow = immediate && !timeoutId;
|
|
29380
|
+
|
|
29381
|
+
if (!timeoutId) {
|
|
29382
|
+
timeoutId = setTimeout(later, wait);
|
|
29383
|
+
}
|
|
29384
|
+
|
|
29385
|
+
if (callNow) {
|
|
29386
|
+
result = run();
|
|
29387
|
+
return result;
|
|
29388
|
+
}
|
|
29389
|
+
|
|
29390
|
+
return undefined;
|
|
29391
|
+
};
|
|
29392
|
+
|
|
29393
|
+
Object.defineProperty(debounced, 'isPending', {
|
|
29394
|
+
get() {
|
|
29395
|
+
return timeoutId !== undefined;
|
|
29396
|
+
},
|
|
29397
|
+
});
|
|
29398
|
+
|
|
29399
|
+
debounced.clear = () => {
|
|
29400
|
+
if (!timeoutId) {
|
|
29401
|
+
return;
|
|
29402
|
+
}
|
|
29403
|
+
|
|
29404
|
+
clearTimeout(timeoutId);
|
|
29405
|
+
timeoutId = undefined;
|
|
29406
|
+
storedContext = undefined;
|
|
29407
|
+
storedArguments = undefined;
|
|
29408
|
+
};
|
|
29409
|
+
|
|
29410
|
+
debounced.flush = () => {
|
|
29411
|
+
if (!timeoutId) {
|
|
29412
|
+
return;
|
|
29413
|
+
}
|
|
29414
|
+
|
|
29415
|
+
debounced.trigger();
|
|
29416
|
+
};
|
|
29417
|
+
|
|
29418
|
+
debounced.trigger = () => {
|
|
29419
|
+
result = run();
|
|
29420
|
+
|
|
29421
|
+
debounced.clear();
|
|
29422
|
+
};
|
|
29423
|
+
|
|
29424
|
+
return debounced;
|
|
29425
|
+
}
|
|
29426
|
+
|
|
29427
|
+
;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=template&id=2c9e224a&scoped=true
|
|
29428
|
+
var PDFPagevue_type_template_id_2c9e224a_scoped_true_render = function render() {
|
|
29429
|
+
var _vm = this,
|
|
29430
|
+
_c = _vm._self._c;
|
|
29431
|
+
return _c('canvas', {
|
|
29432
|
+
ref: "canvas"
|
|
29433
|
+
});
|
|
29434
|
+
};
|
|
29435
|
+
var PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns = [];
|
|
29436
|
+
|
|
29437
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=script&lang=js
|
|
29438
|
+
/* harmony default export */ const PDFPagevue_type_script_lang_js = ({
|
|
29439
|
+
name: 'PDFPage',
|
|
29440
|
+
props: {
|
|
29441
|
+
page: {
|
|
29442
|
+
type: Promise,
|
|
29443
|
+
required: true
|
|
29444
|
+
},
|
|
29445
|
+
scale: {
|
|
29446
|
+
type: Number,
|
|
29447
|
+
default: 1
|
|
29694
29448
|
}
|
|
29695
|
-
|
|
29696
|
-
|
|
29697
|
-
|
|
29698
|
-
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
|
|
29449
|
+
},
|
|
29450
|
+
data() {
|
|
29451
|
+
return {
|
|
29452
|
+
dynamicScale: this.scale,
|
|
29453
|
+
isRendering: false,
|
|
29454
|
+
boundMeasure: null
|
|
29455
|
+
};
|
|
29456
|
+
},
|
|
29457
|
+
watch: {
|
|
29458
|
+
scale(newScale) {
|
|
29459
|
+
this.dynamicScale = newScale;
|
|
29460
|
+
this.render();
|
|
29704
29461
|
}
|
|
29705
|
-
}
|
|
29706
|
-
|
|
29707
|
-
|
|
29708
|
-
|
|
29709
|
-
this.
|
|
29710
|
-
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29462
|
+
},
|
|
29463
|
+
mounted() {
|
|
29464
|
+
this.boundMeasure = this.measure.bind(this);
|
|
29465
|
+
window.addEventListener('resize', this.boundMeasure);
|
|
29466
|
+
this.render();
|
|
29467
|
+
},
|
|
29468
|
+
beforeUnmount() {
|
|
29469
|
+
if (this.boundMeasure) {
|
|
29470
|
+
window.removeEventListener('resize', this.boundMeasure);
|
|
29714
29471
|
}
|
|
29715
|
-
|
|
29716
|
-
|
|
29717
|
-
|
|
29718
|
-
|
|
29719
|
-
|
|
29720
|
-
|
|
29721
|
-
|
|
29722
|
-
|
|
29723
|
-
|
|
29724
|
-
|
|
29725
|
-
|
|
29726
|
-
|
|
29727
|
-
}
|
|
29728
|
-
|
|
29729
|
-
|
|
29730
|
-
|
|
29472
|
+
},
|
|
29473
|
+
methods: {
|
|
29474
|
+
getCanvasMeasurement() {
|
|
29475
|
+
return {
|
|
29476
|
+
canvasWidth: this.$refs.canvas.width,
|
|
29477
|
+
canvasHeight: this.$refs.canvas.height
|
|
29478
|
+
};
|
|
29479
|
+
},
|
|
29480
|
+
measure() {
|
|
29481
|
+
this.$emit('onMeasure', {
|
|
29482
|
+
scale: this.dynamicScale
|
|
29483
|
+
});
|
|
29484
|
+
},
|
|
29485
|
+
async render() {
|
|
29486
|
+
if (this.isRendering) return;
|
|
29487
|
+
this.isRendering = true;
|
|
29488
|
+
try {
|
|
29489
|
+
const _page = await this.page;
|
|
29490
|
+
const canvas = this.$refs.canvas;
|
|
29491
|
+
const context = canvas.getContext('2d');
|
|
29492
|
+
const viewport = _page.getViewport({
|
|
29493
|
+
scale: this.dynamicScale
|
|
29494
|
+
});
|
|
29495
|
+
canvas.width = viewport.width;
|
|
29496
|
+
canvas.height = viewport.height;
|
|
29497
|
+
await _page.render({
|
|
29498
|
+
canvasContext: context,
|
|
29499
|
+
viewport
|
|
29500
|
+
}).promise;
|
|
29501
|
+
this.measure();
|
|
29502
|
+
} finally {
|
|
29503
|
+
this.isRendering = false;
|
|
29731
29504
|
}
|
|
29732
29505
|
}
|
|
29733
29506
|
}
|
|
29734
|
-
|
|
29735
|
-
|
|
29736
|
-
|
|
29737
|
-
|
|
29738
|
-
|
|
29739
|
-
return [pageWidth, pageHeight];
|
|
29740
|
-
}
|
|
29741
|
-
get scale() {
|
|
29742
|
-
return this.#uiManager.viewParameters.realScale;
|
|
29743
|
-
}
|
|
29744
|
-
}
|
|
29507
|
+
});
|
|
29508
|
+
;// ./src/components/PDFPage.vue?vue&type=script&lang=js
|
|
29509
|
+
/* harmony default export */ const components_PDFPagevue_type_script_lang_js = (PDFPagevue_type_script_lang_js);
|
|
29510
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
|
|
29511
|
+
// extracted by mini-css-extract-plugin
|
|
29745
29512
|
|
|
29746
|
-
;// ./src/
|
|
29513
|
+
;// ./src/components/PDFPage.vue?vue&type=style&index=0&id=2c9e224a&prod&scoped=true&lang=css
|
|
29747
29514
|
|
|
29515
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
29516
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
29748
29517
|
|
|
29749
|
-
|
|
29750
|
-
|
|
29751
|
-
|
|
29752
|
-
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29758
|
-
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
|
|
29768
|
-
|
|
29769
|
-
|
|
29770
|
-
|
|
29771
|
-
|
|
29772
|
-
}
|
|
29773
|
-
}
|
|
29774
|
-
static get _svgFactory() {
|
|
29775
|
-
return shadow(this, "_svgFactory", new DOMSVGFactory());
|
|
29776
|
-
}
|
|
29777
|
-
static #setBox(element, [x, y, width, height]) {
|
|
29778
|
-
const {
|
|
29779
|
-
style
|
|
29780
|
-
} = element;
|
|
29781
|
-
style.top = `${100 * y}%`;
|
|
29782
|
-
style.left = `${100 * x}%`;
|
|
29783
|
-
style.width = `${100 * width}%`;
|
|
29784
|
-
style.height = `${100 * height}%`;
|
|
29518
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
29519
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
29520
|
+
// be included in the final webpack user bundle.
|
|
29521
|
+
|
|
29522
|
+
function normalizeComponent(
|
|
29523
|
+
scriptExports,
|
|
29524
|
+
render,
|
|
29525
|
+
staticRenderFns,
|
|
29526
|
+
functionalTemplate,
|
|
29527
|
+
injectStyles,
|
|
29528
|
+
scopeId,
|
|
29529
|
+
moduleIdentifier /* server only */,
|
|
29530
|
+
shadowMode /* vue-cli only */
|
|
29531
|
+
) {
|
|
29532
|
+
// Vue.extend constructor export interop
|
|
29533
|
+
var options =
|
|
29534
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
29535
|
+
|
|
29536
|
+
// render functions
|
|
29537
|
+
if (render) {
|
|
29538
|
+
options.render = render
|
|
29539
|
+
options.staticRenderFns = staticRenderFns
|
|
29540
|
+
options._compiled = true
|
|
29785
29541
|
}
|
|
29786
|
-
|
|
29787
|
-
|
|
29788
|
-
|
|
29789
|
-
|
|
29790
|
-
return svg;
|
|
29542
|
+
|
|
29543
|
+
// functional template
|
|
29544
|
+
if (functionalTemplate) {
|
|
29545
|
+
options.functional = true
|
|
29791
29546
|
}
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29795
|
-
|
|
29796
|
-
clipPath.setAttribute("id", clipPathId);
|
|
29797
|
-
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
|
29798
|
-
const clipPathUse = DrawLayer._svgFactory.createElement("use");
|
|
29799
|
-
clipPath.append(clipPathUse);
|
|
29800
|
-
clipPathUse.setAttribute("href", `#${pathId}`);
|
|
29801
|
-
clipPathUse.classList.add("clip");
|
|
29802
|
-
return clipPathId;
|
|
29547
|
+
|
|
29548
|
+
// scopedId
|
|
29549
|
+
if (scopeId) {
|
|
29550
|
+
options._scopeId = 'data-v-' + scopeId
|
|
29803
29551
|
}
|
|
29804
|
-
|
|
29805
|
-
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
|
|
29552
|
+
|
|
29553
|
+
var hook
|
|
29554
|
+
if (moduleIdentifier) {
|
|
29555
|
+
// server build
|
|
29556
|
+
hook = function (context) {
|
|
29557
|
+
// 2.3 injection
|
|
29558
|
+
context =
|
|
29559
|
+
context || // cached call
|
|
29560
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
29561
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
29562
|
+
// 2.2 with runInNewContext: true
|
|
29563
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
29564
|
+
context = __VUE_SSR_CONTEXT__
|
|
29565
|
+
}
|
|
29566
|
+
// inject component styles
|
|
29567
|
+
if (injectStyles) {
|
|
29568
|
+
injectStyles.call(this, context)
|
|
29569
|
+
}
|
|
29570
|
+
// register component module identifier for async chunk inferrence
|
|
29571
|
+
if (context && context._registeredComponents) {
|
|
29572
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
29810
29573
|
}
|
|
29811
29574
|
}
|
|
29575
|
+
// used by ssr in case component is cached and beforeCreate
|
|
29576
|
+
// never gets called
|
|
29577
|
+
options._ssrRegister = hook
|
|
29578
|
+
} else if (injectStyles) {
|
|
29579
|
+
hook = shadowMode
|
|
29580
|
+
? function () {
|
|
29581
|
+
injectStyles.call(
|
|
29582
|
+
this,
|
|
29583
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
29584
|
+
)
|
|
29585
|
+
}
|
|
29586
|
+
: injectStyles
|
|
29812
29587
|
}
|
|
29813
|
-
|
|
29814
|
-
|
|
29815
|
-
|
|
29816
|
-
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
|
|
29823
|
-
|
|
29824
|
-
|
|
29825
|
-
}
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
|
|
29829
|
-
use.setAttribute("href", `#${pathId}`);
|
|
29830
|
-
this.updateProperties(root, properties);
|
|
29831
|
-
this.#mapping.set(id, root);
|
|
29832
|
-
return {
|
|
29833
|
-
id,
|
|
29834
|
-
clipPathId: `url(#${clipPathId})`
|
|
29835
|
-
};
|
|
29836
|
-
}
|
|
29837
|
-
drawOutline(properties, mustRemoveSelfIntersections) {
|
|
29838
|
-
const id = DrawLayer.#id++;
|
|
29839
|
-
const root = this.#createSVG();
|
|
29840
|
-
const defs = DrawLayer._svgFactory.createElement("defs");
|
|
29841
|
-
root.append(defs);
|
|
29842
|
-
const path = DrawLayer._svgFactory.createElement("path");
|
|
29843
|
-
defs.append(path);
|
|
29844
|
-
const pathId = `path_p${this.pageIndex}_${id}`;
|
|
29845
|
-
path.setAttribute("id", pathId);
|
|
29846
|
-
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
29847
|
-
let maskId;
|
|
29848
|
-
if (mustRemoveSelfIntersections) {
|
|
29849
|
-
const mask = DrawLayer._svgFactory.createElement("mask");
|
|
29850
|
-
defs.append(mask);
|
|
29851
|
-
maskId = `mask_p${this.pageIndex}_${id}`;
|
|
29852
|
-
mask.setAttribute("id", maskId);
|
|
29853
|
-
mask.setAttribute("maskUnits", "objectBoundingBox");
|
|
29854
|
-
const rect = DrawLayer._svgFactory.createElement("rect");
|
|
29855
|
-
mask.append(rect);
|
|
29856
|
-
rect.setAttribute("width", "1");
|
|
29857
|
-
rect.setAttribute("height", "1");
|
|
29858
|
-
rect.setAttribute("fill", "white");
|
|
29859
|
-
const use = DrawLayer._svgFactory.createElement("use");
|
|
29860
|
-
mask.append(use);
|
|
29861
|
-
use.setAttribute("href", `#${pathId}`);
|
|
29862
|
-
use.setAttribute("stroke", "none");
|
|
29863
|
-
use.setAttribute("fill", "black");
|
|
29864
|
-
use.setAttribute("fill-rule", "nonzero");
|
|
29865
|
-
use.classList.add("mask");
|
|
29866
|
-
}
|
|
29867
|
-
const use1 = DrawLayer._svgFactory.createElement("use");
|
|
29868
|
-
root.append(use1);
|
|
29869
|
-
use1.setAttribute("href", `#${pathId}`);
|
|
29870
|
-
if (maskId) {
|
|
29871
|
-
use1.setAttribute("mask", `url(#${maskId})`);
|
|
29588
|
+
|
|
29589
|
+
if (hook) {
|
|
29590
|
+
if (options.functional) {
|
|
29591
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
29592
|
+
// go through the normalizer
|
|
29593
|
+
options._injectStyles = hook
|
|
29594
|
+
// register for functional component in vue file
|
|
29595
|
+
var originalRender = options.render
|
|
29596
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
29597
|
+
hook.call(context)
|
|
29598
|
+
return originalRender(h, context)
|
|
29599
|
+
}
|
|
29600
|
+
} else {
|
|
29601
|
+
// inject component registration as beforeCreate hook
|
|
29602
|
+
var existing = options.beforeCreate
|
|
29603
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
29872
29604
|
}
|
|
29873
|
-
const use2 = use1.cloneNode();
|
|
29874
|
-
root.append(use2);
|
|
29875
|
-
use1.classList.add("mainOutline");
|
|
29876
|
-
use2.classList.add("secondaryOutline");
|
|
29877
|
-
this.updateProperties(root, properties);
|
|
29878
|
-
this.#mapping.set(id, root);
|
|
29879
|
-
return id;
|
|
29880
29605
|
}
|
|
29881
|
-
|
|
29882
|
-
|
|
29883
|
-
|
|
29606
|
+
|
|
29607
|
+
return {
|
|
29608
|
+
exports: scriptExports,
|
|
29609
|
+
options: options
|
|
29884
29610
|
}
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
29889
|
-
|
|
29890
|
-
|
|
29891
|
-
|
|
29892
|
-
|
|
29893
|
-
|
|
29894
|
-
|
|
29895
|
-
|
|
29896
|
-
|
|
29897
|
-
|
|
29611
|
+
}
|
|
29612
|
+
|
|
29613
|
+
;// ./src/components/PDFPage.vue
|
|
29614
|
+
|
|
29615
|
+
|
|
29616
|
+
|
|
29617
|
+
;
|
|
29618
|
+
|
|
29619
|
+
|
|
29620
|
+
/* normalize component */
|
|
29621
|
+
|
|
29622
|
+
var component = normalizeComponent(
|
|
29623
|
+
components_PDFPagevue_type_script_lang_js,
|
|
29624
|
+
PDFPagevue_type_template_id_2c9e224a_scoped_true_render,
|
|
29625
|
+
PDFPagevue_type_template_id_2c9e224a_scoped_true_staticRenderFns,
|
|
29626
|
+
false,
|
|
29627
|
+
null,
|
|
29628
|
+
"2c9e224a",
|
|
29629
|
+
null
|
|
29630
|
+
|
|
29631
|
+
)
|
|
29632
|
+
|
|
29633
|
+
/* harmony default export */ const PDFPage = (component.exports);
|
|
29634
|
+
;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=template&id=55db89ce&scoped=true
|
|
29635
|
+
var DraggableElementvue_type_template_id_55db89ce_scoped_true_render = function render() {
|
|
29636
|
+
var _vm = this,
|
|
29637
|
+
_c = _vm._self._c;
|
|
29638
|
+
return _c('div', {
|
|
29639
|
+
staticClass: "draggable-wrapper"
|
|
29640
|
+
}, [_vm.isSelected && !_vm.isBeingDraggedGlobally && _vm.showSelectionUi && _vm.showDefaultActions ? _c('div', {
|
|
29641
|
+
staticClass: "actions-toolbar",
|
|
29642
|
+
style: _vm.toolbarStyle
|
|
29643
|
+
}, [_vm._t("actions", function () {
|
|
29644
|
+
return [_c('button', {
|
|
29645
|
+
staticClass: "action-btn",
|
|
29646
|
+
attrs: {
|
|
29647
|
+
"type": "button",
|
|
29648
|
+
"title": "Delete"
|
|
29649
|
+
},
|
|
29650
|
+
on: {
|
|
29651
|
+
"click": function ($event) {
|
|
29652
|
+
$event.stopPropagation();
|
|
29653
|
+
return _vm.onDelete.apply(null, arguments);
|
|
29654
|
+
}
|
|
29655
|
+
}
|
|
29656
|
+
}, [_c('svg', {
|
|
29657
|
+
attrs: {
|
|
29658
|
+
"width": "16",
|
|
29659
|
+
"height": "16",
|
|
29660
|
+
"viewBox": "0 0 16 16",
|
|
29661
|
+
"fill": "currentColor"
|
|
29662
|
+
}
|
|
29663
|
+
}, [_c('path', {
|
|
29664
|
+
attrs: {
|
|
29665
|
+
"d": "M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.5a.5.5 0 0 0 0 1h.5v10.5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5V3.5h.5a.5.5 0 0 0 0-1H11Zm1 1v10.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5V3.5h8Z"
|
|
29666
|
+
}
|
|
29667
|
+
})])])];
|
|
29668
|
+
}, {
|
|
29669
|
+
"object": _vm.object,
|
|
29670
|
+
"onDelete": _vm.onDelete
|
|
29671
|
+
})], 2) : _vm._e(), _c('div', {
|
|
29672
|
+
staticClass: "draggable-element",
|
|
29673
|
+
class: {
|
|
29674
|
+
selected: _vm.isSelected && _vm.showSelectionUi
|
|
29675
|
+
},
|
|
29676
|
+
style: [_vm.elementStyle, _vm.dragElementStyle],
|
|
29677
|
+
attrs: {
|
|
29678
|
+
"draggable": "false"
|
|
29679
|
+
},
|
|
29680
|
+
on: {
|
|
29681
|
+
"dragstart": function ($event) {
|
|
29682
|
+
$event.preventDefault();
|
|
29683
|
+
},
|
|
29684
|
+
"mousedown": _vm.handleElementClick,
|
|
29685
|
+
"touchstart": _vm.handleElementClick
|
|
29898
29686
|
}
|
|
29899
|
-
|
|
29900
|
-
|
|
29687
|
+
}, [_vm._t("default", null, {
|
|
29688
|
+
"object": _vm.object,
|
|
29689
|
+
"isSelected": _vm.isSelected,
|
|
29690
|
+
"onDelete": _vm.onDelete,
|
|
29691
|
+
"onResize": _vm.startResizeFromSlot
|
|
29692
|
+
}), _vm.isSelected && _vm.showSelectionUi ? _vm._l(_vm.resizeDirections, function (dir) {
|
|
29693
|
+
return _c('button', {
|
|
29694
|
+
key: dir,
|
|
29695
|
+
staticClass: "resize-handle",
|
|
29696
|
+
class: `handle-${dir}`,
|
|
29697
|
+
attrs: {
|
|
29698
|
+
"type": "button"
|
|
29699
|
+
},
|
|
29700
|
+
on: {
|
|
29701
|
+
"mousedown": function ($event) {
|
|
29702
|
+
$event.stopPropagation();
|
|
29703
|
+
$event.preventDefault();
|
|
29704
|
+
return _vm.startResize(dir, $event);
|
|
29705
|
+
},
|
|
29706
|
+
"touchstart": function ($event) {
|
|
29707
|
+
$event.stopPropagation();
|
|
29708
|
+
$event.preventDefault();
|
|
29709
|
+
return _vm.startResize(dir, $event);
|
|
29710
|
+
}
|
|
29711
|
+
}
|
|
29712
|
+
});
|
|
29713
|
+
}) : _vm._e()], 2)]);
|
|
29714
|
+
};
|
|
29715
|
+
var DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns = [];
|
|
29716
|
+
|
|
29717
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=script&lang=js
|
|
29718
|
+
/* harmony default export */ const DraggableElementvue_type_script_lang_js = ({
|
|
29719
|
+
name: 'DraggableElement',
|
|
29720
|
+
props: {
|
|
29721
|
+
object: {
|
|
29722
|
+
type: Object,
|
|
29723
|
+
required: true
|
|
29724
|
+
},
|
|
29725
|
+
pagesScale: {
|
|
29726
|
+
type: Number,
|
|
29727
|
+
default: 1
|
|
29728
|
+
},
|
|
29729
|
+
pageWidth: {
|
|
29730
|
+
type: Number,
|
|
29731
|
+
required: true
|
|
29732
|
+
},
|
|
29733
|
+
pageHeight: {
|
|
29734
|
+
type: Number,
|
|
29735
|
+
required: true
|
|
29736
|
+
},
|
|
29737
|
+
onUpdate: {
|
|
29738
|
+
type: Function,
|
|
29739
|
+
default: () => {}
|
|
29740
|
+
},
|
|
29741
|
+
onDelete: {
|
|
29742
|
+
type: Function,
|
|
29743
|
+
default: () => {}
|
|
29744
|
+
},
|
|
29745
|
+
onDragStart: {
|
|
29746
|
+
type: Function,
|
|
29747
|
+
default: () => {}
|
|
29748
|
+
},
|
|
29749
|
+
onDragMove: {
|
|
29750
|
+
type: Function,
|
|
29751
|
+
default: () => {}
|
|
29752
|
+
},
|
|
29753
|
+
onDragEnd: {
|
|
29754
|
+
type: Function,
|
|
29755
|
+
default: () => {}
|
|
29756
|
+
},
|
|
29757
|
+
isBeingDraggedGlobally: {
|
|
29758
|
+
type: Boolean,
|
|
29759
|
+
default: false
|
|
29760
|
+
},
|
|
29761
|
+
draggingClientPos: {
|
|
29762
|
+
type: Object,
|
|
29763
|
+
default: () => ({
|
|
29764
|
+
x: 0,
|
|
29765
|
+
y: 0
|
|
29766
|
+
})
|
|
29767
|
+
},
|
|
29768
|
+
currentDocIndex: {
|
|
29769
|
+
type: Number,
|
|
29770
|
+
default: -1
|
|
29771
|
+
},
|
|
29772
|
+
currentPageIndex: {
|
|
29773
|
+
type: Number,
|
|
29774
|
+
default: -1
|
|
29775
|
+
},
|
|
29776
|
+
globalDragDocIndex: {
|
|
29777
|
+
type: Number,
|
|
29778
|
+
default: -1
|
|
29779
|
+
},
|
|
29780
|
+
globalDragPageIndex: {
|
|
29781
|
+
type: Number,
|
|
29782
|
+
default: -1
|
|
29783
|
+
},
|
|
29784
|
+
showSelectionUi: {
|
|
29785
|
+
type: Boolean,
|
|
29786
|
+
default: true
|
|
29787
|
+
},
|
|
29788
|
+
showDefaultActions: {
|
|
29789
|
+
type: Boolean,
|
|
29790
|
+
default: true
|
|
29901
29791
|
}
|
|
29902
|
-
|
|
29903
|
-
|
|
29792
|
+
},
|
|
29793
|
+
data() {
|
|
29794
|
+
return {
|
|
29795
|
+
isSelected: false,
|
|
29796
|
+
mode: 'idle',
|
|
29797
|
+
direction: '',
|
|
29798
|
+
startX: 0,
|
|
29799
|
+
startY: 0,
|
|
29800
|
+
startLeft: 0,
|
|
29801
|
+
startTop: 0,
|
|
29802
|
+
startWidth: 0,
|
|
29803
|
+
startHeight: 0,
|
|
29804
|
+
offsetX: 0,
|
|
29805
|
+
offsetY: 0,
|
|
29806
|
+
resizeOffsetX: 0,
|
|
29807
|
+
resizeOffsetY: 0,
|
|
29808
|
+
resizeOffsetW: 0,
|
|
29809
|
+
resizeOffsetH: 0,
|
|
29810
|
+
aspectRatio: 1,
|
|
29811
|
+
lastMouseX: 0,
|
|
29812
|
+
lastMouseY: 0,
|
|
29813
|
+
pointerOffsetDoc: {
|
|
29814
|
+
x: 0,
|
|
29815
|
+
y: 0
|
|
29816
|
+
},
|
|
29817
|
+
currentPageRect: null,
|
|
29818
|
+
rafId: null
|
|
29819
|
+
};
|
|
29820
|
+
},
|
|
29821
|
+
computed: {
|
|
29822
|
+
resizeDirections() {
|
|
29823
|
+
return ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
|
29824
|
+
},
|
|
29825
|
+
elementStyle() {
|
|
29826
|
+
const scale = this.pagesScale || 1;
|
|
29827
|
+
const currentX = this.object.x + this.offsetX + this.resizeOffsetX;
|
|
29828
|
+
const currentY = this.object.y + this.offsetY + this.resizeOffsetY;
|
|
29829
|
+
const currentWidth = this.object.width + this.resizeOffsetW;
|
|
29830
|
+
const currentHeight = this.object.height + this.resizeOffsetH;
|
|
29831
|
+
return {
|
|
29832
|
+
left: `${currentX * scale}px`,
|
|
29833
|
+
top: `${currentY * scale}px`,
|
|
29834
|
+
width: `${currentWidth * scale}px`,
|
|
29835
|
+
height: `${currentHeight * scale}px`
|
|
29836
|
+
};
|
|
29837
|
+
},
|
|
29838
|
+
toolbarStyle() {
|
|
29839
|
+
const scale = this.pagesScale || 1;
|
|
29840
|
+
const x = this.object.x + this.offsetX + this.resizeOffsetX;
|
|
29841
|
+
const y = this.object.y + this.offsetY + this.resizeOffsetY;
|
|
29842
|
+
const width = this.object.width + this.resizeOffsetW;
|
|
29843
|
+
return {
|
|
29844
|
+
left: `${(x + width / 2) * scale}px`,
|
|
29845
|
+
top: `${(y - 48) * scale}px`,
|
|
29846
|
+
transform: 'translateX(-50%)'
|
|
29847
|
+
};
|
|
29848
|
+
},
|
|
29849
|
+
dragElementStyle() {
|
|
29850
|
+
if (!this.isBeingDraggedGlobally || !this.draggingClientPos) {
|
|
29851
|
+
return {};
|
|
29852
|
+
}
|
|
29853
|
+
return {
|
|
29854
|
+
opacity: 0,
|
|
29855
|
+
pointerEvents: 'none'
|
|
29856
|
+
};
|
|
29904
29857
|
}
|
|
29905
|
-
|
|
29906
|
-
|
|
29907
|
-
|
|
29908
|
-
|
|
29909
|
-
|
|
29910
|
-
|
|
29858
|
+
},
|
|
29859
|
+
mounted() {
|
|
29860
|
+
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
29861
|
+
this.boundHandleMove = this.handleMove.bind(this);
|
|
29862
|
+
this.boundStopInteraction = this.stopInteraction.bind(this);
|
|
29863
|
+
document.addEventListener('mousedown', this.handleClickOutside);
|
|
29864
|
+
document.addEventListener('touchstart', this.handleClickOutside);
|
|
29865
|
+
},
|
|
29866
|
+
beforeUnmount() {
|
|
29867
|
+
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
29868
|
+
document.removeEventListener('touchstart', this.handleClickOutside);
|
|
29869
|
+
window.removeEventListener('mousemove', this.boundHandleMove);
|
|
29870
|
+
window.removeEventListener('mouseup', this.boundStopInteraction);
|
|
29871
|
+
window.removeEventListener('touchmove', this.boundHandleMove);
|
|
29872
|
+
window.removeEventListener('touchend', this.boundStopInteraction);
|
|
29873
|
+
if (this.rafId) cancelAnimationFrame(this.rafId);
|
|
29874
|
+
},
|
|
29875
|
+
methods: {
|
|
29876
|
+
handleElementClick(event) {
|
|
29877
|
+
if (event.target.closest('.delete-handle') || event.target.closest('[data-stop-drag]') || event.target.closest('.actions-toolbar')) {
|
|
29878
|
+
return;
|
|
29879
|
+
}
|
|
29880
|
+
event.preventDefault();
|
|
29881
|
+
this.isSelected = true;
|
|
29882
|
+
this.startDrag(event);
|
|
29883
|
+
},
|
|
29884
|
+
handleClickOutside(event) {
|
|
29885
|
+
if (this.$el && !this.$el.contains(event.target)) {
|
|
29886
|
+
this.isSelected = false;
|
|
29887
|
+
}
|
|
29888
|
+
},
|
|
29889
|
+
startResizeFromSlot(direction, event) {
|
|
29890
|
+
if (!direction || !event) return;
|
|
29891
|
+
this.startResize(direction, event);
|
|
29892
|
+
},
|
|
29893
|
+
startDrag(event) {
|
|
29894
|
+
if (event.target.classList.contains('delete')) return;
|
|
29895
|
+
if (event.target.classList.contains('resize-handle')) return;
|
|
29896
|
+
this.mode = 'drag';
|
|
29897
|
+
this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
|
|
29898
|
+
this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
|
|
29899
|
+
this.startLeft = this.object.x;
|
|
29900
|
+
this.startTop = this.object.y;
|
|
29901
|
+
this.offsetX = 0;
|
|
29902
|
+
this.offsetY = 0;
|
|
29903
|
+
this.resetResizeOffsets();
|
|
29904
|
+
const elementRect = this.$el.querySelector('.draggable-element').getBoundingClientRect();
|
|
29905
|
+
this.pointerOffsetDoc.x = this.startX - elementRect.left;
|
|
29906
|
+
this.pointerOffsetDoc.y = this.startY - elementRect.top;
|
|
29907
|
+
const pageRect = this.capturePageRect();
|
|
29908
|
+
this.currentPageRect = pageRect;
|
|
29909
|
+
let dragElementShift = {
|
|
29910
|
+
x: 0,
|
|
29911
|
+
y: 0
|
|
29912
|
+
};
|
|
29913
|
+
if (pageRect) {
|
|
29914
|
+
const expectedLeft = pageRect.left + this.object.x * this.pagesScale;
|
|
29915
|
+
const expectedTop = pageRect.top + this.object.y * this.pagesScale;
|
|
29916
|
+
dragElementShift = {
|
|
29917
|
+
x: elementRect.left - expectedLeft,
|
|
29918
|
+
y: elementRect.top - expectedTop
|
|
29919
|
+
};
|
|
29920
|
+
}
|
|
29921
|
+
this.onDragStart(this.startX, this.startY, {
|
|
29922
|
+
...this.pointerOffsetDoc
|
|
29923
|
+
}, dragElementShift);
|
|
29924
|
+
window.addEventListener('mousemove', this.boundHandleMove);
|
|
29925
|
+
window.addEventListener('mouseup', this.boundStopInteraction);
|
|
29926
|
+
window.addEventListener('touchmove', this.boundHandleMove);
|
|
29927
|
+
window.addEventListener('touchend', this.boundStopInteraction);
|
|
29928
|
+
},
|
|
29929
|
+
startResize(direction, event) {
|
|
29930
|
+
this.mode = 'resize';
|
|
29931
|
+
this.direction = direction;
|
|
29932
|
+
this.startX = event.type.includes('touch') ? event.touches[0].clientX : event.clientX;
|
|
29933
|
+
this.startY = event.type.includes('touch') ? event.touches[0].clientY : event.clientY;
|
|
29934
|
+
this.startLeft = this.object.x;
|
|
29935
|
+
this.startTop = this.object.y;
|
|
29936
|
+
this.startWidth = this.object.width;
|
|
29937
|
+
this.startHeight = this.object.height;
|
|
29938
|
+
this.aspectRatio = this.startWidth / this.startHeight;
|
|
29939
|
+
this.offsetX = 0;
|
|
29940
|
+
this.offsetY = 0;
|
|
29941
|
+
this.resetResizeOffsets();
|
|
29942
|
+
window.addEventListener('mousemove', this.boundHandleMove);
|
|
29943
|
+
window.addEventListener('mouseup', this.boundStopInteraction);
|
|
29944
|
+
window.addEventListener('touchmove', this.boundHandleMove);
|
|
29945
|
+
window.addEventListener('touchend', this.boundStopInteraction);
|
|
29946
|
+
},
|
|
29947
|
+
handleMove(event) {
|
|
29948
|
+
if (this.mode === 'idle') return;
|
|
29949
|
+
event.preventDefault();
|
|
29950
|
+
if (this.rafId) return;
|
|
29951
|
+
this.rafId = requestAnimationFrame(() => {
|
|
29952
|
+
const currentX = event.type.includes('touch') ? event.touches[0]?.clientX : event.clientX;
|
|
29953
|
+
const currentY = event.type.includes('touch') ? event.touches[0]?.clientY : event.clientY;
|
|
29954
|
+
if (currentX === undefined || currentY === undefined) return;
|
|
29955
|
+
this.lastMouseX = currentX;
|
|
29956
|
+
this.lastMouseY = currentY;
|
|
29957
|
+
const deltaX = (currentX - this.startX) / this.pagesScale;
|
|
29958
|
+
const deltaY = (currentY - this.startY) / this.pagesScale;
|
|
29959
|
+
if (this.mode === 'drag') {
|
|
29960
|
+
const pageRect = this.currentPageRect;
|
|
29961
|
+
if (pageRect) {
|
|
29962
|
+
const newElementLeft = currentX - this.pointerOffsetDoc.x;
|
|
29963
|
+
const newElementTop = currentY - this.pointerOffsetDoc.y;
|
|
29964
|
+
const newX = (newElementLeft - pageRect.left) / this.pagesScale;
|
|
29965
|
+
const newY = (newElementTop - pageRect.top) / this.pagesScale;
|
|
29966
|
+
this.offsetX = newX - this.object.x;
|
|
29967
|
+
this.offsetY = newY - this.object.y;
|
|
29968
|
+
} else {
|
|
29969
|
+
this.offsetX = deltaX;
|
|
29970
|
+
this.offsetY = deltaY;
|
|
29971
|
+
}
|
|
29972
|
+
this.onDragMove(currentX, currentY);
|
|
29973
|
+
if (this.isBeingDraggedGlobally) {
|
|
29974
|
+
this.onUpdate({
|
|
29975
|
+
_globalDrag: true,
|
|
29976
|
+
_mouseX: currentX,
|
|
29977
|
+
_mouseY: currentY
|
|
29978
|
+
});
|
|
29979
|
+
}
|
|
29980
|
+
this.rafId = null;
|
|
29981
|
+
return;
|
|
29982
|
+
}
|
|
29983
|
+
const minSize = 16;
|
|
29984
|
+
let newWidth = this.startWidth;
|
|
29985
|
+
let newHeight = this.startHeight;
|
|
29986
|
+
let newLeft = this.startLeft;
|
|
29987
|
+
let newTop = this.startTop;
|
|
29988
|
+
const widthChange = this.direction.includes('right') ? deltaX : this.direction.includes('left') ? -deltaX : 0;
|
|
29989
|
+
newWidth = this.startWidth + widthChange;
|
|
29990
|
+
if (newWidth < minSize) newWidth = minSize;
|
|
29991
|
+
newHeight = newWidth / this.aspectRatio;
|
|
29992
|
+
if (this.direction.includes('left')) {
|
|
29993
|
+
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
29994
|
+
if (newLeft < 0) {
|
|
29995
|
+
const overflow = -newLeft;
|
|
29996
|
+
newLeft = 0;
|
|
29997
|
+
newWidth = newWidth - overflow;
|
|
29998
|
+
newHeight = newWidth / this.aspectRatio;
|
|
29999
|
+
}
|
|
30000
|
+
}
|
|
30001
|
+
if (this.direction.includes('top')) {
|
|
30002
|
+
newTop = this.startTop + (this.startHeight - newHeight);
|
|
30003
|
+
if (newTop < 0) {
|
|
30004
|
+
const overflow = -newTop;
|
|
30005
|
+
newTop = 0;
|
|
30006
|
+
newHeight = newHeight - overflow;
|
|
30007
|
+
newWidth = newHeight * this.aspectRatio;
|
|
30008
|
+
if (this.direction.includes('left')) {
|
|
30009
|
+
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
30010
|
+
}
|
|
30011
|
+
}
|
|
30012
|
+
}
|
|
30013
|
+
if (newLeft + newWidth > this.pageWidth) {
|
|
30014
|
+
const excess = newLeft + newWidth - this.pageWidth;
|
|
30015
|
+
newWidth -= excess;
|
|
30016
|
+
newHeight = newWidth / this.aspectRatio;
|
|
30017
|
+
}
|
|
30018
|
+
if (newTop + newHeight > this.pageHeight) {
|
|
30019
|
+
const excess = newTop + newHeight - this.pageHeight;
|
|
30020
|
+
newHeight -= excess;
|
|
30021
|
+
newWidth = newHeight * this.aspectRatio;
|
|
30022
|
+
if (this.direction.includes('left')) {
|
|
30023
|
+
newLeft = this.startLeft + (this.startWidth - newWidth);
|
|
30024
|
+
}
|
|
30025
|
+
}
|
|
30026
|
+
this.resizeOffsetX = newLeft - this.object.x;
|
|
30027
|
+
this.resizeOffsetY = newTop - this.object.y;
|
|
30028
|
+
this.resizeOffsetW = newWidth - this.object.width;
|
|
30029
|
+
this.resizeOffsetH = newHeight - this.object.height;
|
|
30030
|
+
this.rafId = null;
|
|
30031
|
+
});
|
|
30032
|
+
},
|
|
30033
|
+
stopInteraction() {
|
|
30034
|
+
if (this.mode === 'idle') return;
|
|
30035
|
+
if (this.mode === 'drag' && (this.offsetX !== 0 || this.offsetY !== 0)) {
|
|
30036
|
+
if (this.isBeingDraggedGlobally) {
|
|
30037
|
+
this.onUpdate({
|
|
30038
|
+
_globalDrag: true,
|
|
30039
|
+
_mouseX: this.lastMouseX,
|
|
30040
|
+
_mouseY: this.lastMouseY
|
|
30041
|
+
});
|
|
30042
|
+
} else {
|
|
30043
|
+
const x = Math.max(0, Math.min(this.object.x + this.offsetX, this.pageWidth - this.object.width));
|
|
30044
|
+
const y = Math.max(0, Math.min(this.object.y + this.offsetY, this.pageHeight - this.object.height));
|
|
30045
|
+
this.onUpdate({
|
|
30046
|
+
x,
|
|
30047
|
+
y
|
|
30048
|
+
});
|
|
30049
|
+
}
|
|
29911
30050
|
}
|
|
30051
|
+
if (this.mode === 'resize' && (this.resizeOffsetW !== 0 || this.resizeOffsetH !== 0 || this.resizeOffsetX !== 0 || this.resizeOffsetY !== 0)) {
|
|
30052
|
+
const x = this.object.x + this.resizeOffsetX;
|
|
30053
|
+
const y = this.object.y + this.resizeOffsetY;
|
|
30054
|
+
const width = this.object.width + this.resizeOffsetW;
|
|
30055
|
+
const height = this.object.height + this.resizeOffsetH;
|
|
30056
|
+
this.onUpdate({
|
|
30057
|
+
x,
|
|
30058
|
+
y,
|
|
30059
|
+
width,
|
|
30060
|
+
height
|
|
30061
|
+
});
|
|
30062
|
+
}
|
|
30063
|
+
this.resetOffsets();
|
|
30064
|
+
this.onDragEnd();
|
|
30065
|
+
window.removeEventListener('mousemove', this.boundHandleMove);
|
|
30066
|
+
window.removeEventListener('mouseup', this.boundStopInteraction);
|
|
30067
|
+
window.removeEventListener('touchmove', this.boundHandleMove);
|
|
30068
|
+
window.removeEventListener('touchend', this.boundStopInteraction);
|
|
30069
|
+
},
|
|
30070
|
+
capturePageRect() {
|
|
30071
|
+
const wrapper = this.$el.closest('.page-wrapper');
|
|
30072
|
+
if (!wrapper) return null;
|
|
30073
|
+
const canvas = wrapper.querySelector('canvas');
|
|
30074
|
+
return canvas ? canvas.getBoundingClientRect() : null;
|
|
30075
|
+
},
|
|
30076
|
+
resetResizeOffsets() {
|
|
30077
|
+
this.resizeOffsetX = 0;
|
|
30078
|
+
this.resizeOffsetY = 0;
|
|
30079
|
+
this.resizeOffsetW = 0;
|
|
30080
|
+
this.resizeOffsetH = 0;
|
|
30081
|
+
},
|
|
30082
|
+
resetOffsets() {
|
|
30083
|
+
this.mode = 'idle';
|
|
30084
|
+
this.offsetX = 0;
|
|
30085
|
+
this.offsetY = 0;
|
|
30086
|
+
this.resetResizeOffsets();
|
|
30087
|
+
this.pointerOffsetDoc = {
|
|
30088
|
+
x: 0,
|
|
30089
|
+
y: 0
|
|
30090
|
+
};
|
|
30091
|
+
this.currentPageRect = null;
|
|
29912
30092
|
}
|
|
29913
|
-
if (path) {
|
|
29914
|
-
const defs = element.firstElementChild;
|
|
29915
|
-
const pathElement = defs.firstElementChild;
|
|
29916
|
-
this.#updateProperties(pathElement, path);
|
|
29917
|
-
}
|
|
29918
|
-
}
|
|
29919
|
-
updateParent(id, layer) {
|
|
29920
|
-
if (layer === this) {
|
|
29921
|
-
return;
|
|
29922
|
-
}
|
|
29923
|
-
const root = this.#mapping.get(id);
|
|
29924
|
-
if (!root) {
|
|
29925
|
-
return;
|
|
29926
|
-
}
|
|
29927
|
-
layer.#parent.append(root);
|
|
29928
|
-
this.#mapping.delete(id);
|
|
29929
|
-
layer.#mapping.set(id, root);
|
|
29930
|
-
}
|
|
29931
|
-
remove(id) {
|
|
29932
|
-
this.#toUpdate.delete(id);
|
|
29933
|
-
if (this.#parent === null) {
|
|
29934
|
-
return;
|
|
29935
|
-
}
|
|
29936
|
-
this.#mapping.get(id).remove();
|
|
29937
|
-
this.#mapping.delete(id);
|
|
29938
|
-
}
|
|
29939
|
-
destroy() {
|
|
29940
|
-
this.#parent = null;
|
|
29941
|
-
for (const root of this.#mapping.values()) {
|
|
29942
|
-
root.remove();
|
|
29943
|
-
}
|
|
29944
|
-
this.#mapping.clear();
|
|
29945
|
-
this.#toUpdate.clear();
|
|
29946
30093
|
}
|
|
29947
|
-
}
|
|
29948
|
-
|
|
29949
|
-
|
|
29950
|
-
|
|
29951
|
-
|
|
29952
|
-
|
|
29953
|
-
|
|
29954
|
-
|
|
29955
|
-
|
|
29956
|
-
|
|
29957
|
-
|
|
29958
|
-
|
|
29959
|
-
|
|
30094
|
+
});
|
|
30095
|
+
;// ./src/components/DraggableElement.vue?vue&type=script&lang=js
|
|
30096
|
+
/* harmony default export */ const components_DraggableElementvue_type_script_lang_js = (DraggableElementvue_type_script_lang_js);
|
|
30097
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
|
|
30098
|
+
// extracted by mini-css-extract-plugin
|
|
29960
30099
|
|
|
30100
|
+
;// ./src/components/DraggableElement.vue?vue&type=style&index=0&id=55db89ce&prod&scoped=true&lang=css
|
|
29961
30101
|
|
|
30102
|
+
;// ./src/components/DraggableElement.vue
|
|
29962
30103
|
|
|
29963
30104
|
|
|
29964
30105
|
|
|
30106
|
+
;
|
|
29965
30107
|
|
|
29966
|
-
{
|
|
29967
|
-
globalThis._pdfjsTestingUtils = {
|
|
29968
|
-
HighlightOutliner: HighlightOutliner
|
|
29969
|
-
};
|
|
29970
|
-
}
|
|
29971
|
-
globalThis.pdfjsLib = {
|
|
29972
|
-
AbortException: AbortException,
|
|
29973
|
-
AnnotationEditorLayer: AnnotationEditorLayer,
|
|
29974
|
-
AnnotationEditorParamsType: AnnotationEditorParamsType,
|
|
29975
|
-
AnnotationEditorType: AnnotationEditorType,
|
|
29976
|
-
AnnotationEditorUIManager: AnnotationEditorUIManager,
|
|
29977
|
-
AnnotationLayer: AnnotationLayer,
|
|
29978
|
-
AnnotationMode: AnnotationMode,
|
|
29979
|
-
AnnotationType: AnnotationType,
|
|
29980
|
-
applyOpacity: applyOpacity,
|
|
29981
|
-
build: build,
|
|
29982
|
-
ColorPicker: ColorPicker,
|
|
29983
|
-
createValidAbsoluteUrl: createValidAbsoluteUrl,
|
|
29984
|
-
CSSConstants: CSSConstants,
|
|
29985
|
-
DOMSVGFactory: DOMSVGFactory,
|
|
29986
|
-
DrawLayer: DrawLayer,
|
|
29987
|
-
FeatureTest: util_FeatureTest,
|
|
29988
|
-
fetchData: fetchData,
|
|
29989
|
-
findContrastColor: findContrastColor,
|
|
29990
|
-
getDocument: getDocument,
|
|
29991
|
-
getFilenameFromUrl: getFilenameFromUrl,
|
|
29992
|
-
getPdfFilenameFromUrl: getPdfFilenameFromUrl,
|
|
29993
|
-
getRGB: getRGB,
|
|
29994
|
-
getUuid: getUuid,
|
|
29995
|
-
getXfaPageViewport: getXfaPageViewport,
|
|
29996
|
-
GlobalWorkerOptions: GlobalWorkerOptions,
|
|
29997
|
-
ImageKind: util_ImageKind,
|
|
29998
|
-
InvalidPDFException: InvalidPDFException,
|
|
29999
|
-
isDataScheme: isDataScheme,
|
|
30000
|
-
isPdfFile: isPdfFile,
|
|
30001
|
-
isValidExplicitDest: isValidExplicitDest,
|
|
30002
|
-
MathClamp: MathClamp,
|
|
30003
|
-
noContextMenu: noContextMenu,
|
|
30004
|
-
normalizeUnicode: normalizeUnicode,
|
|
30005
|
-
OPS: OPS,
|
|
30006
|
-
OutputScale: OutputScale,
|
|
30007
|
-
PasswordResponses: PasswordResponses,
|
|
30008
|
-
PDFDataRangeTransport: PDFDataRangeTransport,
|
|
30009
|
-
PDFDateString: PDFDateString,
|
|
30010
|
-
PDFWorker: PDFWorker,
|
|
30011
|
-
PermissionFlag: PermissionFlag,
|
|
30012
|
-
PixelsPerInch: PixelsPerInch,
|
|
30013
|
-
RenderingCancelledException: RenderingCancelledException,
|
|
30014
|
-
renderRichText: renderRichText,
|
|
30015
|
-
ResponseException: ResponseException,
|
|
30016
|
-
setLayerDimensions: setLayerDimensions,
|
|
30017
|
-
shadow: shadow,
|
|
30018
|
-
SignatureExtractor: SignatureExtractor,
|
|
30019
|
-
stopEvent: stopEvent,
|
|
30020
|
-
SupportedImageMimeTypes: SupportedImageMimeTypes,
|
|
30021
|
-
TextLayer: TextLayer,
|
|
30022
|
-
TouchManager: TouchManager,
|
|
30023
|
-
updateUrlHash: updateUrlHash,
|
|
30024
|
-
Util: Util,
|
|
30025
|
-
VerbosityLevel: VerbosityLevel,
|
|
30026
|
-
version: version,
|
|
30027
|
-
XfaLayer: XfaLayer
|
|
30028
|
-
};
|
|
30029
30108
|
|
|
30109
|
+
/* normalize component */
|
|
30030
30110
|
|
|
30111
|
+
var DraggableElement_component = normalizeComponent(
|
|
30112
|
+
components_DraggableElementvue_type_script_lang_js,
|
|
30113
|
+
DraggableElementvue_type_template_id_55db89ce_scoped_true_render,
|
|
30114
|
+
DraggableElementvue_type_template_id_55db89ce_scoped_true_staticRenderFns,
|
|
30115
|
+
false,
|
|
30116
|
+
null,
|
|
30117
|
+
"55db89ce",
|
|
30118
|
+
null
|
|
30119
|
+
|
|
30120
|
+
)
|
|
30031
30121
|
|
|
30032
|
-
|
|
30033
|
-
;// ./node_modules/pdfjs-dist/build/pdf.worker.min.mjs
|
|
30034
|
-
const pdf_worker_min_namespaceObject = __webpack_require__.p + "pdf.worker.min.mjs";
|
|
30122
|
+
/* harmony default export */ const DraggableElement = (DraggableElement_component.exports);
|
|
30035
30123
|
;// ./src/utils/asyncReader.js
|
|
30036
30124
|
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
|
|
30037
30125
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
30038
30126
|
|
|
30039
30127
|
|
|
30040
30128
|
|
|
30041
|
-
|
|
30129
|
+
pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
|
|
30130
|
+
function setWorkerPath(path) {
|
|
30131
|
+
GlobalWorkerOptions.workerSrc = path;
|
|
30132
|
+
}
|
|
30042
30133
|
function readAsArrayBuffer(file) {
|
|
30043
30134
|
return new Promise((resolve, reject) => {
|
|
30044
30135
|
const reader = new FileReader();
|
|
@@ -30061,6 +30152,7 @@ function readAsPDF(file) {
|
|
|
30061
30152
|
|
|
30062
30153
|
|
|
30063
30154
|
|
|
30155
|
+
|
|
30064
30156
|
/* harmony default export */ const PDFElementsvue_type_script_lang_js = ({
|
|
30065
30157
|
name: 'PDFElements',
|
|
30066
30158
|
components: {
|
|
@@ -30159,7 +30251,8 @@ function readAsPDF(file) {
|
|
|
30159
30251
|
zoomRafId: null,
|
|
30160
30252
|
boundHandleWheel: null,
|
|
30161
30253
|
debouncedApplyZoom: null,
|
|
30162
|
-
visualScale: this.initialScale
|
|
30254
|
+
visualScale: this.initialScale,
|
|
30255
|
+
resizeObserver: null
|
|
30163
30256
|
};
|
|
30164
30257
|
},
|
|
30165
30258
|
mounted() {
|
|
@@ -30185,6 +30278,14 @@ function readAsPDF(file) {
|
|
|
30185
30278
|
});
|
|
30186
30279
|
if (this.autoFitZoom) {
|
|
30187
30280
|
window.addEventListener('resize', this.adjustZoomToFit);
|
|
30281
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
30282
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
30283
|
+
this.scheduleAutoFitZoom();
|
|
30284
|
+
});
|
|
30285
|
+
if (this.$el) {
|
|
30286
|
+
this.resizeObserver.observe(this.$el);
|
|
30287
|
+
}
|
|
30288
|
+
}
|
|
30188
30289
|
}
|
|
30189
30290
|
},
|
|
30190
30291
|
beforeUnmount() {
|
|
@@ -30205,6 +30306,10 @@ function readAsPDF(file) {
|
|
|
30205
30306
|
this.$el?.removeEventListener('scroll', this.onViewportScroll);
|
|
30206
30307
|
if (this.autoFitZoom) {
|
|
30207
30308
|
window.removeEventListener('resize', this.adjustZoomToFit);
|
|
30309
|
+
if (this.resizeObserver) {
|
|
30310
|
+
this.resizeObserver.disconnect();
|
|
30311
|
+
this.resizeObserver = null;
|
|
30312
|
+
}
|
|
30208
30313
|
}
|
|
30209
30314
|
if (this.viewportRafId) {
|
|
30210
30315
|
window.cancelAnimationFrame(this.viewportRafId);
|
|
@@ -30228,8 +30333,18 @@ function readAsPDF(file) {
|
|
|
30228
30333
|
pdfDoc = await readAsPDF(file);
|
|
30229
30334
|
}
|
|
30230
30335
|
const pages = [];
|
|
30336
|
+
const pageWidths = Array(pdfDoc.numPages).fill(0);
|
|
30231
30337
|
for (let p = 1; p <= pdfDoc.numPages; p++) {
|
|
30232
|
-
|
|
30338
|
+
const pagePromise = pdfDoc.getPage(p);
|
|
30339
|
+
pagePromise.then(page => {
|
|
30340
|
+
pageWidths[p - 1] = page.getViewport({
|
|
30341
|
+
scale: 1
|
|
30342
|
+
}).width;
|
|
30343
|
+
if (this.autoFitZoom) {
|
|
30344
|
+
this.scheduleAutoFitZoom();
|
|
30345
|
+
}
|
|
30346
|
+
});
|
|
30347
|
+
pages.push(pagePromise);
|
|
30233
30348
|
}
|
|
30234
30349
|
docs.push({
|
|
30235
30350
|
name,
|
|
@@ -30237,6 +30352,7 @@ function readAsPDF(file) {
|
|
|
30237
30352
|
pdfDoc,
|
|
30238
30353
|
numPages: pdfDoc.numPages,
|
|
30239
30354
|
pages,
|
|
30355
|
+
pageWidths,
|
|
30240
30356
|
pagesScale: Array(pdfDoc.numPages).fill(this.scale),
|
|
30241
30357
|
allObjects: Array(pdfDoc.numPages).fill(0).map(() => [])
|
|
30242
30358
|
});
|
|
@@ -30248,6 +30364,11 @@ function readAsPDF(file) {
|
|
|
30248
30364
|
this.$emit('pdf-elements:end-init', {
|
|
30249
30365
|
docsCount: docs.length
|
|
30250
30366
|
});
|
|
30367
|
+
this.$nextTick(() => {
|
|
30368
|
+
if (this.autoFitZoom) {
|
|
30369
|
+
this.scheduleAutoFitZoom();
|
|
30370
|
+
}
|
|
30371
|
+
});
|
|
30251
30372
|
}
|
|
30252
30373
|
},
|
|
30253
30374
|
selectPage(docIndex, pageIndex) {
|
|
@@ -30667,6 +30788,9 @@ function readAsPDF(file) {
|
|
|
30667
30788
|
if (docIndex < 0 || docIndex >= this.pdfDocuments.length) return;
|
|
30668
30789
|
this.pdfDocuments[docIndex].pagesScale[pageIndex] = e.scale;
|
|
30669
30790
|
this.cachePageBounds();
|
|
30791
|
+
if (this.autoFitZoom) {
|
|
30792
|
+
this.scheduleAutoFitZoom();
|
|
30793
|
+
}
|
|
30670
30794
|
},
|
|
30671
30795
|
formatPageNumber(currentPage, totalPages) {
|
|
30672
30796
|
return this.pageCountFormat.replace('{currentPage}', currentPage).replace('{totalPages}', totalPages);
|
|
@@ -30691,25 +30815,46 @@ function readAsPDF(file) {
|
|
|
30691
30815
|
const availableWidth = containerWidth - 40;
|
|
30692
30816
|
return Math.max(0.1, Math.min(2, availableWidth / maxPageWidth));
|
|
30693
30817
|
},
|
|
30818
|
+
scheduleAutoFitZoom() {
|
|
30819
|
+
if (this.zoomRafId) return;
|
|
30820
|
+
this.zoomRafId = window.requestAnimationFrame(() => {
|
|
30821
|
+
this.zoomRafId = 0;
|
|
30822
|
+
this.adjustZoomToFit();
|
|
30823
|
+
});
|
|
30824
|
+
},
|
|
30694
30825
|
adjustZoomToFit() {
|
|
30695
30826
|
if (!this.autoFitZoom || !this.pdfDocuments.length) return;
|
|
30696
|
-
const
|
|
30697
|
-
|
|
30698
|
-
|
|
30827
|
+
const widths = this.pdfDocuments.flatMap(doc => doc.pageWidths || []).filter(width => width > 0);
|
|
30828
|
+
let maxCanvasWidth = 0;
|
|
30829
|
+
if (widths.length) {
|
|
30830
|
+
maxCanvasWidth = Math.max(...widths);
|
|
30831
|
+
} else {
|
|
30832
|
+
if (this.autoFitZoom) {
|
|
30833
|
+
this.scheduleAutoFitZoom();
|
|
30834
|
+
return;
|
|
30835
|
+
}
|
|
30836
|
+
const canvases = this.$el?.querySelectorAll('canvas');
|
|
30837
|
+
if (!canvases?.length) return;
|
|
30838
|
+
maxCanvasWidth = Math.max(...Array.from(canvases).map(canvas => canvas.width / (this.scale || 1)));
|
|
30839
|
+
}
|
|
30699
30840
|
const optimalScale = this.calculateOptimalScale(maxCanvasWidth);
|
|
30700
30841
|
if (Math.abs(optimalScale - this.scale) > 0.01) {
|
|
30701
30842
|
this.scale = optimalScale;
|
|
30702
30843
|
this.visualScale = optimalScale;
|
|
30844
|
+
this.pdfDocuments.forEach(doc => {
|
|
30845
|
+
doc.pagesScale = doc.pagesScale.map(() => this.scale);
|
|
30846
|
+
});
|
|
30847
|
+
this.cachePageBounds();
|
|
30703
30848
|
}
|
|
30704
30849
|
}
|
|
30705
30850
|
}
|
|
30706
30851
|
});
|
|
30707
30852
|
;// ./src/components/PDFElements.vue?vue&type=script&lang=js
|
|
30708
30853
|
/* harmony default export */ const components_PDFElementsvue_type_script_lang_js = (PDFElementsvue_type_script_lang_js);
|
|
30709
|
-
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=
|
|
30854
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/PDFElements.vue?vue&type=style&index=0&id=ddd8aa14&prod&scoped=true&lang=css
|
|
30710
30855
|
// extracted by mini-css-extract-plugin
|
|
30711
30856
|
|
|
30712
|
-
;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=
|
|
30857
|
+
;// ./src/components/PDFElements.vue?vue&type=style&index=0&id=ddd8aa14&prod&scoped=true&lang=css
|
|
30713
30858
|
|
|
30714
30859
|
;// ./src/components/PDFElements.vue
|
|
30715
30860
|
|
|
@@ -30726,7 +30871,7 @@ var PDFElements_component = normalizeComponent(
|
|
|
30726
30871
|
staticRenderFns,
|
|
30727
30872
|
false,
|
|
30728
30873
|
null,
|
|
30729
|
-
"
|
|
30874
|
+
"ddd8aa14",
|
|
30730
30875
|
null
|
|
30731
30876
|
|
|
30732
30877
|
)
|
|
@@ -30737,6 +30882,10 @@ var PDFElements_component = normalizeComponent(
|
|
|
30737
30882
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
30738
30883
|
|
|
30739
30884
|
|
|
30885
|
+
|
|
30886
|
+
pdf_GlobalWorkerOptions.workerSrc = pdf_worker_min_namespaceObject;
|
|
30887
|
+
|
|
30888
|
+
|
|
30740
30889
|
PDFElements.install = function (Vue) {
|
|
30741
30890
|
if (PDFElements.install.installed) return;
|
|
30742
30891
|
Vue.component(PDFElements.name, PDFElements);
|