kfb-view 2.1.9 → 2.1.12

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kfb-view",
3
3
  "description": "一个在线kfb的阅片软件",
4
- "version": "2.1.9",
4
+ "version": "2.1.12",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -34,7 +34,7 @@
34
34
  "@babel/plugin-proposal-function-bind": "^7.0.0",
35
35
  "@babel/plugin-proposal-function-sent": "^7.0.0",
36
36
  "@babel/plugin-proposal-json-strings": "^7.0.0",
37
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
37
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
38
38
  "@babel/plugin-proposal-numeric-separator": "^7.0.0",
39
39
  "@babel/plugin-proposal-object-rest-spread": "^7.3.1",
40
40
  "@babel/plugin-proposal-optional-chaining": "^7.0.0",
@@ -41,6 +41,7 @@ export class Tailoring extends ViewerCommon {
41
41
  pointList[8]];
42
42
  if (now) {
43
43
  this.$emit(EVENT_TAILORING_SCREENSHOT, this.getScreenCanvasImage());
44
+ this.stopTailoring();
44
45
  } else {
45
46
  this.color = color || '#FFF';
46
47
  this.change();
@@ -226,15 +227,10 @@ export class Tailoring extends ViewerCommon {
226
227
  }
227
228
 
228
229
  onCanvasDblClick(position) {
229
- if (this.tailoringPoints.length === 0) {
230
- this.stopTailoring();
231
- } else {
232
- if (this.isPointInMatrix(position)) {
233
- this.$emit(EVENT_TAILORING_SCREENSHOT, this.getScreenCanvasImage());
234
- } else {
235
- this.stopTailoring();
236
- }
230
+ if (this.tailoringPoints.length > 0 && this.isPointInMatrix(position)) {
231
+ this.$emit(EVENT_TAILORING_SCREENSHOT, this.getScreenCanvasImage());
237
232
  }
233
+ this.stopTailoring();
238
234
  }
239
235
 
240
236
  /**
package/src/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from './util/calculate';
2
2
  export * from './util/imageData';
3
3
  export * from './components';
4
-
4
+ import OpenSeadragon from './plugin/openseadragon/openseadragon';
5
5
  import KfbView from './view';
6
6
 
7
7
  export {
8
8
  KfbView,
9
+ OpenSeadragon,
9
10
  };
@@ -36,9 +36,9 @@ export const rgbToHsl = (r, g, b) => {
36
36
  export const hslToRgb = (h, s, l) => {
37
37
  if (s === 0) {
38
38
  return {
39
- r: l * 255,
40
- g: l * 255,
41
- b: l * 255,
39
+ r: (l > 1 ? 1 : l) * 255,
40
+ g: (l > 1 ? 1 : l) * 255,
41
+ b: (l > 1 ? 1 : l) * 255,
42
42
  };
43
43
  }
44
44
  if (s > 1) s = 1;
@@ -52,7 +52,11 @@ export const hslToRgb = (h, s, l) => {
52
52
  const r = 255 * hueToRGB(v1, v2, h + (1 / 3));
53
53
  const g = 255 * hueToRGB(v1, v2, h);
54
54
  const b = 255 * hueToRGB(v1, v2, h - (1 / 3));
55
- return {r, g, b};
55
+ return {
56
+ r: r > 255 ? 255 : r,
57
+ g: g > 255 ? 255 : g,
58
+ b: b > 255 ? 255 : b,
59
+ };
56
60
  };
57
61
 
58
62
  function hueToRGB(v1, v2, h) {
@@ -72,14 +76,14 @@ export const toGamma = (num, gamma) => {
72
76
  num = 0;
73
77
  }
74
78
  num = num / 255;
75
- const compensate = Math.pow(num, gamma);
79
+ const compensate = Math.pow(num, 1 / gamma);
76
80
  return compensate * 255;
77
81
  };
78
82
 
79
83
  const cacheGammaTable = {};
80
84
 
81
85
  for (let i = 0; i < 256; i++) {
82
- for (let j = 0.01; j <= 5; j = ((j + 0.01).toFixed(3) / 1)) {
86
+ for (let j = 0.01; j <= 2; j = ((j + 0.01).toFixed(3) / 1)) {
83
87
  if (cacheGammaTable[`${j}`]) {
84
88
  cacheGammaTable[`${j}`].push(toGamma(i, j));
85
89
  } else {