kfb-view 3.0.1 → 3.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kfb-view",
3
3
  "description": "一个在线kfb的阅片软件",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -29,11 +29,22 @@ export class Tailoring extends ViewerCommon {
29
29
  this.movePointIndex = -1;
30
30
  this.color = '#FFF';
31
31
  this.contents = [];
32
+ this.imageType = 'jpeg';
32
33
  }
33
34
 
34
- init({width, height, left, top, color, now = false, contents = []}) {
35
+ init({
36
+ width,
37
+ height,
38
+ left,
39
+ top,
40
+ color,
41
+ now = false,
42
+ contents = [],
43
+ suffix = 'jpeg',
44
+ }) {
35
45
  this.isInTailoring = true;
36
46
  this.movePointIndex = -1;
47
+ this.imageType = suffix;
37
48
  const pointList = getRectPoint({x: left, y: top},
38
49
  {x: left + width, y: top + height});
39
50
  this.tailoringPoints = [
@@ -296,7 +307,7 @@ export class Tailoring extends ViewerCommon {
296
307
  startPoint.y * radioY, disWidth, disHeight, 0, 0, disWidth,
297
308
  disHeight);
298
309
  }
299
- return copyCanvas.toDataURL('image/png');
310
+ return copyCanvas.toDataURL(`image/${this.imageType || 'jpeg'}`);
300
311
  } catch (e) {
301
312
  console.error(e);
302
313
  }