Skip to content

Commit 05ea0d7

Browse files
committed
EBEAST: b/part-thumb.vue: freeze immutable allnotes, no need to observe
Signed-off-by: Tim Janik <[email protected]>
1 parent 305f18f commit 05ea0d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ebeast/b/part-thumb.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function observable_part_data () {
3636
partname: { getter: c => this.part.get_name(), notify: n => this.part.on ("notify:uname", n), },
3737
lasttick: { getter: c => this.part.get_last_tick(), notify: n => this.part.on ("notify:last_tick", n), },
3838
allnotes: { default: [], notify: n => this.part.on ("noteschanged", n),
39-
getter: c => this.part.list_notes_crossing (0, CONFIG.MAXINT), },
39+
getter: async c => Object.freeze (await this.part.list_notes_crossing (0, CONFIG.MAXINT)), },
4040
};
4141
return this.observable_from_getters (data, () => this.part);
4242
}
@@ -69,10 +69,10 @@ module.exports = {
6969
function render_canvas () {
7070
// canvas setup
7171
const canvas = this.$refs['canvas'];
72-
Util.resize_canvas (canvas, canvas.clientWidth, canvas.clientHeight, true);
72+
const pixelratio = Util.resize_canvas (canvas, canvas.clientWidth, canvas.clientHeight, true);
7373
const ctx = canvas.getContext ('2d'), cstyle = getComputedStyle (canvas), csp = cstyle.getPropertyValue.bind (cstyle);
7474
const width = canvas.width, height = canvas.height;
75-
const tickscale = this.tickscale * window.devicePixelRatio;
75+
const tickscale = this.tickscale * pixelratio;
7676
//const width = canvas.clientWidth, height = canvas.clientHeight;
7777
//canvas.width = width; canvas.height = height;
7878
ctx.clearRect (0, 0, width, height);
@@ -102,7 +102,7 @@ function render_canvas () {
102102
const noteoffset = 12;
103103
const notescale = height / (123.0 - 2 * noteoffset); // MAX_NOTE
104104
for (const note of pnotes) {
105-
ctx.fillRect (note.tick * tickscale, height - (note.note - noteoffset) * notescale, note.duration * tickscale, 1 * window.devicePixelRatio);
105+
ctx.fillRect (note.tick * tickscale, height - (note.note - noteoffset) * notescale, note.duration * tickscale, 1 * pixelratio);
106106
}
107107
}
108108

0 commit comments

Comments
 (0)