All the improvements as suggested in the comments will be completed in the next commit along with the undo feature.
because the notes whose position are more than 6 on the staff will have ledger lines and in that case the whole note image has to be inverted.
However I've added a readonly property variable for this to make it easy to understand for anyone reading the code.
-6 is the returned value denoting invalid condition. Since the numbers upto -5 are already occupied, I chose -6 to be the invalid case number.
Sure, will create a readonly property for it.