Skip to content

Commit

Permalink
Correctly overwrite addMorph methods in sequence for patching fontRatio
Browse files Browse the repository at this point in the history
Previously we did not overwrite enough methods (addMorph, addMorphBack,...) correctly. The overwriting became necessary to patch _fontRatio into added Morphs with a font and broke a test.
  • Loading branch information
linusha committed Sep 14, 2021
1 parent 2f2c6bc commit 633d230
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,18 @@ export class Sequence extends DeserializationAwareMorph {
this.isHidden = !this.isHidden;
}

addMorph (morph) {
super.addMorph(morph);
addMorph (morph, insertBeforeMorph) {
super.addMorph(morph, insertBeforeMorph);
if (morph.fontSize && this.interactive) morph._fontRatio = morph.fontSize / this.interactive.extent.y;
}

addMorphAt (morph, index) {
super.addMorphAt(morph, index);
if (morph.fontSize && this.interactive) morph._fontRatio = morph.fontSize / this.interactive.extent.y;
}

addMorphBack (morph) {
super.addMorphBack(morph);
if (morph.fontSize && this.interactive) morph._fontRatio = morph.fontSize / this.interactive.extent.y;
}

Expand Down

0 comments on commit 633d230

Please sign in to comment.