kfb-view 3.2.7 → 3.2.8

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.2.7",
4
+ "version": "3.2.8",
5
5
  "author": "qifeng.fan <qifeng.fan@hzztai.com>",
6
6
  "license": "MIT",
7
7
  "main": "lib/kfb-view.js",
@@ -137,17 +137,27 @@ export class Tailoring extends ViewerCommon {
137
137
  ctx.stroke();
138
138
  ctx.beginPath();
139
139
  ctx.fillStyle = '#000000';
140
- ctx.rect(rightTop.x + 4, rightTop.y, 100, 40);
140
+ let areaInterval = 4;
141
+ let areaDist = 100;
142
+ if (rightTop.x + areaDist + areaInterval > this.canvas.width) {
143
+ areaDist = -100;
144
+ areaInterval = -4;
145
+ }
146
+ ctx.rect(rightTop.x + areaInterval, rightTop.y, areaDist, 40);
141
147
  ctx.fill();
142
148
  ctx.save();
143
149
  ctx.beginPath();
144
- ctx.translate(rightTop.x + 54, rightTop.y - 5);
150
+ ctx.translate(rightTop.x + areaInterval + areaDist / 2, rightTop.y - 5);
145
151
  ctx.fillStyle = '#ffffff';
146
152
  ctx.drawConfirm();
147
153
  ctx.restore();
148
154
  ctx.save();
149
155
  ctx.beginPath();
150
- ctx.translate(rightTop.x + 4, rightTop.y - 5);
156
+ if (areaDist < 0) {
157
+ ctx.translate(rightTop.x + areaDist + areaInterval, rightTop.y - 5);
158
+ } else {
159
+ ctx.translate(rightTop.x + areaInterval, rightTop.y - 5);
160
+ }
151
161
  ctx.fillStyle = '#ffffff';
152
162
  ctx.drawCancel();
153
163
  ctx.restore();
@@ -163,8 +173,15 @@ export class Tailoring extends ViewerCommon {
163
173
  this.movePointIndex = this.tailoringPoints.findIndex(
164
174
  (point) => pointInOtherPoint(point, {x, y}, 30));
165
175
  const rightTopPoint = this.tailoringPoints[1];
166
- const cancelArea = new Rect(rightTopPoint.x + 14, rightTopPoint.y, 30, 40);
167
- const confirmArea = new Rect(rightTopPoint.x + 64, rightTopPoint.y, 30, 40);
176
+
177
+ let areaInterval = 4;
178
+ let areaDist = 100;
179
+ let cancelArea = new Rect(rightTopPoint.x + 14, rightTopPoint.y, 30, 40);
180
+ let confirmArea = new Rect(rightTopPoint.x + 64, rightTopPoint.y, 30, 40);
181
+ if (rightTopPoint.x + areaDist + areaInterval > this.canvas.width) {
182
+ cancelArea = new Rect(rightTopPoint.x - 94, rightTopPoint.y, 30, 40);
183
+ confirmArea = new Rect(rightTopPoint.x - 44, rightTopPoint.y, 30, 40);
184
+ }
168
185
  const point = new Point(x, y);
169
186
  if (cancelArea.containsPoint(point)) {
170
187
  this.stopTailoring();
@@ -257,6 +274,20 @@ export class Tailoring extends ViewerCommon {
257
274
  };
258
275
  break;
259
276
  }
277
+ this.tailoringPoints.forEach((i) => {
278
+ if (i.x < 0) {
279
+ i.x = 0;
280
+ }
281
+ if (i.y < 0) {
282
+ i.y = 0;
283
+ }
284
+ if (i.x > this.canvas.width) {
285
+ i.x = this.canvas.width;
286
+ }
287
+ if (i.y > this.canvas.height) {
288
+ i.y = this.canvas.height;
289
+ }
290
+ });
260
291
  this.clearCanvas();
261
292
  this.drawRect();
262
293
  this.drawTailoring();