centaline-data-driven 1.4.61 → 1.4.62

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,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven",
3
- "version": "1.4.61",
3
+ "version": "1.4.62",
4
4
  "description": "ccai",
5
5
  "author": "hjc <3226136347@qq.com>",
6
6
  "private": false,
@@ -21,7 +21,7 @@
21
21
  </a>
22
22
  </div>
23
23
  </div>
24
- <div class="stream-total-tips" v-if="progressFlag">
24
+ <div class="stream-total-tips" v-if="progressFlag">
25
25
  <el-progress type="circle"
26
26
  :percentage="typeof loadProgress !== 'undefined' && loadProgress !== null ? loadProgress : 0.00"
27
27
  :width="150" :height="150" class="file-cirle"></el-progress>
@@ -58,6 +58,9 @@
58
58
  canMove: false,
59
59
  PaintMove: false,
60
60
  isActive: false,
61
+ bodywidth: 0,
62
+ bodyheight: 0,
63
+ scale:1,
61
64
  tx: 0,
62
65
  ty: 0,
63
66
  tl: 0,
@@ -124,6 +127,10 @@
124
127
  mounted() {
125
128
  this.progressFlag = false;
126
129
  this.loadProgress = 0;
130
+ var width = parseInt(window.document.body.clientWidth * 0.8);
131
+ width = width > 1160 ? 1160 : width;
132
+ this.bodywidth = width;
133
+ this.bodyheight = parseInt(window.document.body.clientHeight * 0.8);
127
134
  if (typeof this.minWidth == 'undefined' || typeof this.minWidth == 'undefined') {
128
135
  this.cropBoxResizable = true;
129
136
  }
@@ -153,25 +160,23 @@
153
160
  _this.canvas.width = naturalWidth;
154
161
  _this.canvas.height = naturalHeight;
155
162
  _this.ctx.drawImage(_this.imgObj, 0, 0, naturalWidth, naturalHeight)
156
-
157
- var scale = 1;
158
- var scalew = 900 / _this.imgObj.width;
159
- var scaleh = window.document.body.clientHeight / _this.imgObj.height;
163
+ var scalew = _this.bodywidth / _this.imgObj.width;
164
+ var scaleh = _this.bodyheight / _this.imgObj.height;
160
165
  if (scalew < 1 && scaleh < 1) {
161
166
  if (scalew < scaleh) {
162
- scale = scalew;
167
+ _this.scale = scalew;
163
168
  }
164
169
  else {
165
- scale = scaleh;
170
+ _this.scale = scaleh;
166
171
  }
167
172
  }
168
173
  else if (scalew > 1 && scaleh < 1) {
169
- scale = scaleh;
174
+ _this.scale = scaleh;
170
175
  }
171
176
  else if (scalew < 1 && scaleh > 1) {
172
- scale = scalew;
177
+ _this.scale = scalew;
173
178
  }
174
- _this.scaleDomSize(_this.canvas, scale);
179
+ _this.scaleDomSize(_this.canvas);
175
180
  }
176
181
  this.canvas.addEventListener("pointerdown", _this.startDraw, false);
177
182
  this.canvas.addEventListener("pointermove", _this.draw, false);
@@ -283,25 +288,15 @@
283
288
  },
284
289
  //放大缩小
285
290
  scaleDom(canvas, type) {
286
- let scale = parseFloat((canvas.style.transform || `scale(1)`).replace(/[^0-9.]/gi, ''))
287
291
  if (type == "-") {
288
- scale += -0.1;
289
- if ((scale <= 1 && canvas.width > 900) || (scale <= 1 && canvas.height > (window.document.body.clientHeight))) {
290
- canvas.style.left = - canvas.width * 0.05 * ((1 - scale) * 10) + 'px';
291
- canvas.style.top = -canvas.height * 0.05 * ((1 - scale) * 10) + 'px';
292
- }
292
+ this.scale += -0.1;
293
293
  } else if (type == "+") {
294
- scale += 0.1;
295
- if ((scale <= 1 && canvas.width > 900) || (scale <= 1 && canvas.height > (window.document.body.clientHeight))) {
296
- canvas.style.left = - canvas.width * 0.05 * ((1 - scale) * 10) + 'px';
297
- canvas.style.top = -canvas.height * 0.05 * ((1 - scale) * 10) + 'px';
298
- }
294
+ this.scale += 0.1;
299
295
  }
300
296
  else {
301
- scale = 1;
297
+ this.scale = 1;
302
298
  }
303
- if (scale >= 0.1) canvas.style.transform = `scale(${scale})`;
304
-
299
+ this.scaleDomSize(canvas);
305
300
  },
306
301
  rotLeft() {
307
302
  this.rot -= 90;
@@ -350,6 +345,7 @@
350
345
  context.drawImage(img, 0, 0, w, h);
351
346
  context.restore();
352
347
  img.style.display = "none";
348
+ this.scaleDomSize(canvas);
353
349
  },
354
350
  Crop() {
355
351
  let _this = this
@@ -411,8 +407,6 @@
411
407
  clear() {
412
408
  this.drawCanv();
413
409
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
414
- this.canvas.style.left = '0px';
415
- this.canvas.style.top = '0px';
416
410
  this.rot = 0;
417
411
  this.nl = 0;
418
412
  this.nt = 0;
@@ -422,12 +416,10 @@
422
416
  this.scaleDom(this.canvas, "");
423
417
  this.rotate(this.canvas, this.imgObj, this.rot);
424
418
  },
425
- scaleDomSize(canvas, scale) {
426
- if ((scale <= 1 && canvas.width > 900) || (scale <= 1 && canvas.height > (window.document.body.clientHeight))) {
427
- canvas.style.left = - canvas.width * 0.05 * ((1 - scale) * 10) + 'px';
428
- canvas.style.top = -canvas.height * 0.05 * ((1 - scale) * 10) + 'px';
429
- }
430
- if (scale >= 0.1) canvas.style.transform = `scale(${scale})`;
419
+ scaleDomSize(canvas) {
420
+ canvas.style.transform = `scale(${this.scale})`;
421
+ canvas.style.left = (- canvas.width * 0.05 * ((1 - this.scale) * 10)) + ((this.bodywidth - canvas.width * this.scale) / 2) + 'px';
422
+ canvas.style.top = (-canvas.height * 0.05 * ((1 - this.scale) * 10)) + ((this.bodyheight - canvas.height * this.scale) / 2) + 'px';
431
423
  },
432
424
  async preservation() {
433
425
  this.progressFlag = true;
@@ -649,7 +641,7 @@
649
641
  .stream-total-tips {
650
642
  position: fixed;
651
643
  top: 40%;
652
- left: 40%;
644
+ left: 45%;
653
645
  z-index: 9999;
654
646
  }
655
647
 
@@ -356,9 +356,11 @@ const box = function (source, fileSourceList, router, optionApi,videoPlayIconUrl
356
356
  data = rtn.getFileData(res.content.media);
357
357
  data.progressFlag = false;
358
358
  data.loadProgress = 100;
359
- const img = await this.imgFn(data.mediaUrl);
360
- w = img.width;
361
- h = img.height ;
359
+ if (data.mediaTypeID == 2) {
360
+ const img = await this.imgFn(data.mediaUrl);
361
+ w = img.width;
362
+ h = img.height;
363
+ }
362
364
  Vue.set(file, "width", w);
363
365
  Vue.set(file, "height", h);
364
366
  Vue.set(file, "url", data.url);