-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draw colored Background Layer #318
base: develop
Are you sure you want to change the base?
Changes from all commits
e573414
8fc4a39
e2c37c6
65d1d30
c62fb02
41ee64f
27a17ed
deca591
82a0a34
3ab11ba
73cdb2b
b1d1dee
76d0f93
9b5e602
f2107c1
ada473e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,11 +158,16 @@ export class OpenSheetMusicDisplay { | |
this.graphic.Cursors.push(this.graphic.calculateCursorLineAtTimestamp(new Fraction(7, 4), OutlineAndFillStyleEnum.PlaybackCursor));*/ | ||
// Update Sheet Page | ||
const height: number = this.graphic.MusicPages[0].PositionAndShape.BorderBottom * 10.0 * this.zoom; | ||
|
||
this.drawer.clear(); | ||
this.drawer.resize(width, height); | ||
this.drawer.scale(this.zoom); | ||
// clear and fill with background color | ||
this.drawer.clear(0, 0, width, height); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are 2 clears. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the first clear actually only removes the SVG children in the SVG backend in this case. I left it in in case the resizing and scaling is slower if we don't remove the SVG children beforehand. So, clear without arguments behaves like before, clear with position and dimensions makes a colored background (rectangle). We could separate these methods, of course. But i don't think removing children from a list or drawing a single rectangle costs much performance. |
||
|
||
// Finally, draw | ||
this.drawer.drawSheet(this.graphic); | ||
|
||
// Update the cursor position | ||
this.cursor.update(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like the idea that I need to know my canvas size to clear it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only need to know it if you want to fill it with the background color though. with default arguments it behaves as before. Also, canvas.width and canvas.height is often wrong in the canvas backend, too small.