Cache line highlight pattern to improve performance
This commit is contained in:
parent
2de03ff7f7
commit
f88c1f1408
|
|
@ -2,6 +2,7 @@
|
||||||
New features:
|
New features:
|
||||||
- Add "New Window" command
|
- Add "New Window" command
|
||||||
- Enable files to be opened with Lightningbeam
|
- Enable files to be opened with Lightningbeam
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
- Fix error when an object is deleted from a frame
|
- Fix error when an object is deleted from a frame
|
||||||
- Fix parent references being lost
|
- Fix parent references being lost
|
||||||
|
|
|
||||||
30
src/main.js
30
src/main.js
|
|
@ -2960,20 +2960,22 @@ class BaseShape {
|
||||||
ctx.lineCap = "round";
|
ctx.lineCap = "round";
|
||||||
|
|
||||||
// Create a repeating pattern for indicating selected shapes
|
// Create a repeating pattern for indicating selected shapes
|
||||||
let patternCanvas = document.createElement('canvas');
|
if (!this.patternCanvas) {
|
||||||
patternCanvas.width = 2;
|
this.patternCanvas = document.createElement('canvas');
|
||||||
patternCanvas.height = 2;
|
this.patternCanvas.width = 2;
|
||||||
let patternCtx = patternCanvas.getContext('2d');
|
this.patternCanvas.height = 2;
|
||||||
// Draw the pattern:
|
let patternCtx = this.patternCanvas.getContext('2d');
|
||||||
// black, transparent,
|
// Draw the pattern:
|
||||||
// transparent, white
|
// black, transparent,
|
||||||
patternCtx.fillStyle = 'black';
|
// transparent, white
|
||||||
patternCtx.fillRect(0, 0, 1, 1);
|
patternCtx.fillStyle = 'black';
|
||||||
patternCtx.clearRect(1, 0, 1, 1);
|
patternCtx.fillRect(0, 0, 1, 1);
|
||||||
patternCtx.clearRect(0, 1, 1, 1);
|
patternCtx.clearRect(1, 0, 1, 1);
|
||||||
patternCtx.fillStyle = 'white';
|
patternCtx.clearRect(0, 1, 1, 1);
|
||||||
patternCtx.fillRect(1, 1, 1, 1);
|
patternCtx.fillStyle = 'white';
|
||||||
let pattern = ctx.createPattern(patternCanvas, 'repeat'); // repeat the pattern across the canvas
|
patternCtx.fillRect(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
let pattern = ctx.createPattern(this.patternCanvas, 'repeat'); // repeat the pattern across the canvas
|
||||||
|
|
||||||
// for (let region of this.regions) {
|
// for (let region of this.regions) {
|
||||||
// // if (region.filled) continue;
|
// // if (region.filled) continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue