(e)
| 31 | } |
| 32 | |
| 33 | handleMouseMove(e) { |
| 34 | if (this.main.colorPicker.choosing && !e.altKey) { |
| 35 | if (!this.shown) { |
| 36 | this.shown = true; |
| 37 | this.zomer.style.display = 'block'; |
| 38 | this.cursor = this.wrapper.style.cursor; |
| 39 | this.wrapper.style.cursor = 'none'; |
| 40 | } |
| 41 | const scale = this.main.getScale(); |
| 42 | const cord = [ |
| 43 | (e.clientX - this.main.elLeft()) + this.main.scroller.scrollLeft, |
| 44 | (e.clientY - this.main.elTop()) + this.main.scroller.scrollTop, |
| 45 | ]; |
| 46 | |
| 47 | let x = cord[0] * scale; |
| 48 | x = x < 1 ? 1 : x; |
| 49 | x = x > this.main.size.w - 1 ? this.main.size.w - 1 : x; |
| 50 | let y = cord[1] * scale; |
| 51 | y = y < 1 ? 1 : y; |
| 52 | y = y > this.main.size.h - 1 ? this.main.size.h - 1 : y; |
| 53 | |
| 54 | const captW = this.captW; |
| 55 | const periodW = this.periodW; |
| 56 | |
| 57 | for (let i = 0; i < captW; i += 1) { |
| 58 | for (let j = 0; j < captW; j += 1) { |
| 59 | const d = this.ctx.getImageData((x + i) - this.middle, (y + j) - this.middle, 1, 1); |
| 60 | for (let ii = 0; ii < periodW; ii += 1) { |
| 61 | for (let jj = 0; jj < periodW; jj += 1) { |
| 62 | if (ii === periodW - 1 || jj === periodW - 1) { |
| 63 | if ((i === this.middle && j === this.middle) || |
| 64 | (i === this.middle && j === this.middle - 1 && jj === periodW - 1) || |
| 65 | (i === this.middle - 1 && j === this.middle && ii === periodW - 1)) { |
| 66 | this.zomerCtx.putImageData( |
| 67 | this.gridColorRed, (i * periodW) + ii, |
| 68 | (j * periodW) + jj); |
| 69 | } else { |
| 70 | this.zomerCtx.putImageData( |
| 71 | this.gridColor, (i * periodW) + ii, |
| 72 | (j * periodW) + jj); |
| 73 | } |
| 74 | } else { |
| 75 | this.zomerCtx.putImageData(d, (i * periodW) + ii, (j * periodW) + jj); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | this.zomer.style.left = `${e.clientX - this.wrapper.documentOffsetLeft - this.halfFullW}px`; |
| 82 | this.zomer.style.top = `${e.clientY - this.wrapper.documentOffsetTop - this.halfFullW}px`; |
| 83 | } else if (this.shown) { |
| 84 | this.hideZoomHelper(); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | hideZoomHelper() { |
| 89 | this.zomer.style.display = 'none'; |
no test coverage detected