| 920 | } |
| 921 | |
| 922 | handleClipCopyEvent(evt) { |
| 923 | let handled = false; |
| 924 | const clipFormat = 'image/png'; |
| 925 | if (evt.keyCode === KEYS.c && (evt.ctrlKey || evt.metaKey)) { |
| 926 | if (!this.inserter.waitChoice && !this.select.imagePlaced && this.select.shown) { |
| 927 | const a = this.select.area; |
| 928 | const w = a.bottoml[0] - a.topl[0]; |
| 929 | const h = a.bottoml[1] - a.topl[1]; |
| 930 | const tmpCan = this.doc.createElement('canvas'); |
| 931 | tmpCan.width = w; |
| 932 | tmpCan.height = h; |
| 933 | const tmpCtx = tmpCan.getContext('2d'); |
| 934 | tmpCtx.drawImage(this.canvas, -a.topl[0], -a.topl[1]); |
| 935 | tmpCan.toBlob((b) => { |
| 936 | /* eslint no-undef: "off" */ |
| 937 | navigator.clipboard.write([new ClipboardItem({ [clipFormat]: b })]); |
| 938 | }, clipFormat, 1.0); |
| 939 | handled = true; |
| 940 | } else { |
| 941 | this.canvas.toBlob((b) => { |
| 942 | /* eslint no-undef: "off" */ |
| 943 | navigator.clipboard.write([new ClipboardItem({ [clipFormat]: b })]); |
| 944 | }, clipFormat, 1.0); |
| 945 | handled = true; |
| 946 | } |
| 947 | } |
| 948 | return handled; |
| 949 | } |
| 950 | zoomImage({ wheelDelta, clientX, clientY }, forceWheenDelta, forceZoomForce) { |
| 951 | let whD = wheelDelta; |
| 952 | if (forceWheenDelta !== undefined) { |