kfb-view 3.2.1 → 3.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/lib/kfb-view.js +1 -1
- package/lib/kfb-view.js.LICENSE.txt +3 -3
- package/package.json +1 -1
- package/src/components/graduation/index.js +0 -1
- package/src/plugin/openseadragon/openseadragon.js +3351 -3851
- package/src/util/index.js +3 -0
- package/src/view.js +10 -3
package/src/util/index.js
CHANGED
|
@@ -65,6 +65,9 @@ function delayedTrigger(callback, time = 1000) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function getUnitNumber(number, units, binary, index = 0) {
|
|
68
|
+
if (index) {
|
|
69
|
+
return (number / Math.pow(binary, index)).toFixed(2) / 1 + units[index];
|
|
70
|
+
}
|
|
68
71
|
let i = number;
|
|
69
72
|
while (i >= binary) {
|
|
70
73
|
i = i / binary;
|
package/src/view.js
CHANGED
|
@@ -35,8 +35,8 @@ export default class KfbView extends EventEmitter {
|
|
|
35
35
|
* @param {number[]=} config.navigator.vestige.zooms 浏览痕迹触发倍率
|
|
36
36
|
* @param {Object} config.pxConversion 像素转换参数
|
|
37
37
|
* @param {number} config.pxConversion.imageCapRes 像素转换倍率
|
|
38
|
-
* @param {string[]=} config.pxConversion.units 单位组
|
|
39
|
-
* @param {string} config.pxConversion.unit 单位
|
|
38
|
+
* @param {string[]=} config.pxConversion.units 单位组 ['um', 'mm', 'cm']
|
|
39
|
+
* @param {string} config.pxConversion.unit 单位 废弃
|
|
40
40
|
* @param {number} config.pxConversion.binary 几进制, 2, 16, 24, 1000
|
|
41
41
|
* @param {Object} config.area 交互区域,触发点击、拖动等事件
|
|
42
42
|
* @param {boolean=} config.area.disabled 是否禁用area
|
|
@@ -85,6 +85,7 @@ export default class KfbView extends EventEmitter {
|
|
|
85
85
|
* @param {function=} config.label.drawing 标注绘制回调,
|
|
86
86
|
* @param {function=} config.labelDrawing 标注绘制回调 @deprecated Use label.drawing instead
|
|
87
87
|
* @param {array} config.labelList 标注列表
|
|
88
|
+
* @param {function} config.handleKey 按钮处理回调
|
|
88
89
|
*/
|
|
89
90
|
constructor(config) {
|
|
90
91
|
super();
|
|
@@ -373,7 +374,9 @@ function initEvent(kv) {
|
|
|
373
374
|
|
|
374
375
|
kv.viewer.addHandler('canvas-key', (e) => {
|
|
375
376
|
const {originalEvent} = e;
|
|
376
|
-
e.preventDefaultAction =
|
|
377
|
+
e.preventDefaultAction = kv.$options.handleKey ?
|
|
378
|
+
kv.$options.handleKey(originalEvent.key) :
|
|
379
|
+
handlerKey(originalEvent.key);
|
|
377
380
|
handlerCacheEvent(originalEvent, kv);
|
|
378
381
|
if (kv.board?.isInDraw) {
|
|
379
382
|
kv.board?.onCanvasKey?.(e);
|
|
@@ -453,6 +456,10 @@ function initEvent(kv) {
|
|
|
453
456
|
});
|
|
454
457
|
}
|
|
455
458
|
|
|
459
|
+
function handlerKey(key) {
|
|
460
|
+
return ['Escape', 'Delete', 'Backspace', 'z', 'y'].includes(key);
|
|
461
|
+
}
|
|
462
|
+
|
|
456
463
|
function handlerCacheEvent(e, kv) {
|
|
457
464
|
if (e.key === 'z' && e.ctrlKey) {
|
|
458
465
|
if (kv.cache.currentIndex === 0) return;
|