kfb-view 3.0.0-beta3 → 3.0.1
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/.idea/workspace.xml +41 -33
- package/config/webpack.dev.conf.js +2 -2
- package/example/index.js +30 -1
- package/lib/kfb-view.js +1 -1
- package/package.json +1 -1
- package/src/components/board/index.js +4 -2
- package/src/components/tailoring/index.js +8 -1
- package/src/const/event.js +1 -0
- package/src/plugin/openseadragon/openseadragon.js +6 -2
- package/src/view.js +1 -0
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
EVENT_START_PAINTING,
|
|
10
10
|
EVENT_END_PAINTING,
|
|
11
|
-
EVENT_IN_PAINTING,
|
|
11
|
+
EVENT_IN_PAINTING, EVENT_STOP_PAINTING,
|
|
12
12
|
} from '../../const/event';
|
|
13
13
|
import {
|
|
14
14
|
getAngle,
|
|
@@ -278,6 +278,7 @@ export class Board extends ViewerCommon {
|
|
|
278
278
|
// 是否只绘制一次
|
|
279
279
|
if (this[this.tool].options.once) {
|
|
280
280
|
this.endDraw();
|
|
281
|
+
this.$emit(EVENT_STOP_PAINTING, this.getPaintOptions());
|
|
281
282
|
} else if (this[this.tool].options.clear) { // 是否结束绘画时清空画布
|
|
282
283
|
this.points = [];
|
|
283
284
|
this.clearCanvas();
|
|
@@ -323,7 +324,8 @@ export class Board extends ViewerCommon {
|
|
|
323
324
|
*/
|
|
324
325
|
onCanvasKey(e) {
|
|
325
326
|
const {originalEvent} = e;
|
|
326
|
-
if (originalEvent.key === 'Escape') {
|
|
327
|
+
if (originalEvent.key === 'Escape' && this.isInDraw) {
|
|
328
|
+
this.$emit(EVENT_STOP_PAINTING, this.getPaintOptions());
|
|
327
329
|
this.endDraw();
|
|
328
330
|
}
|
|
329
331
|
if (originalEvent.key === 'Delete' || originalEvent.key ===
|
|
@@ -21,8 +21,9 @@ export class Tailoring extends ViewerCommon {
|
|
|
21
21
|
* @param {Object} cache
|
|
22
22
|
* @param {Object} options
|
|
23
23
|
*/
|
|
24
|
-
constructor({viewer, canvas, cache, options}) {
|
|
24
|
+
constructor({kv, viewer, canvas, cache, options}) {
|
|
25
25
|
super(viewer, canvas, cache, options);
|
|
26
|
+
this.kv = kv;
|
|
26
27
|
this.isInTailoring = false;
|
|
27
28
|
this.tailoringPoints = [];
|
|
28
29
|
this.movePointIndex = -1;
|
|
@@ -289,6 +290,12 @@ export class Tailoring extends ViewerCommon {
|
|
|
289
290
|
copyCanvas.height = disHeight;
|
|
290
291
|
const copyCtx = copyCanvas.getContext('2d');
|
|
291
292
|
copyCtx.putImageData(imageData, 0, 0, 0, 0, disWidth, disHeight);
|
|
293
|
+
const shapeCanvas = this.kv.shape?.canvas;
|
|
294
|
+
if (shapeCanvas) {
|
|
295
|
+
copyCtx.drawImage(shapeCanvas, startPoint.x * radioX,
|
|
296
|
+
startPoint.y * radioY, disWidth, disHeight, 0, 0, disWidth,
|
|
297
|
+
disHeight);
|
|
298
|
+
}
|
|
292
299
|
return copyCanvas.toDataURL('image/png');
|
|
293
300
|
} catch (e) {
|
|
294
301
|
console.error(e);
|
package/src/const/event.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export const EVENT_START_PAINTING = 'start-painting';
|
|
3
3
|
export const EVENT_IN_PAINTING = 'in-painting';
|
|
4
4
|
export const EVENT_END_PAINTING = 'end-painting';
|
|
5
|
+
export const EVENT_STOP_PAINTING = 'stop-painting';
|
|
5
6
|
export const EVENT_TAILORING_REGION = 'tailoring-region';
|
|
6
7
|
export const EVENT_TAILORING_SCREENSHOT = 'tailoring-screenshot';
|
|
7
8
|
export const EVENT_AREA_MOVE_START = 'area-move-start';
|
|
@@ -9544,7 +9544,10 @@ function OpenSeadragon(options) {
|
|
|
9544
9544
|
} else {
|
|
9545
9545
|
this.addControl(
|
|
9546
9546
|
this.pagingControl,
|
|
9547
|
-
{
|
|
9547
|
+
{
|
|
9548
|
+
anchor: this.sequenceControlAnchor ||
|
|
9549
|
+
$.ControlAnchor.TOP_LEFT,
|
|
9550
|
+
},
|
|
9548
9551
|
);
|
|
9549
9552
|
}
|
|
9550
9553
|
}
|
|
@@ -24271,7 +24274,8 @@ function OpenSeadragon(options) {
|
|
|
24271
24274
|
this.getImage = options.getImage.bind(null, this);
|
|
24272
24275
|
this.getData = options.getData.bind(null, this);
|
|
24273
24276
|
this.getRenderedContext = options.getRenderedContext.bind(null, this);
|
|
24274
|
-
this.getCopyRenderedContext = options.getCopyRenderedContext.bind(null,
|
|
24277
|
+
this.getCopyRenderedContext = options.getCopyRenderedContext.bind(null,
|
|
24278
|
+
this);
|
|
24275
24279
|
};
|
|
24276
24280
|
|
|
24277
24281
|
ImageRecord.prototype = {
|
package/src/view.js
CHANGED