MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / update

Method update

examples/commodetto/progress/main.js:126–133  ·  view source on GitHub ↗
(percent)

Source from the content-addressed store, hash-verified

124 this.fillColor = dictionary.fillColor;
125 }
126 update(percent) {
127 let text = percent + "%";
128 let width = render.getTextWidth(text, this.font);
129 render.begin(this.x, this.y, this.width, this.height);
130 render.fillRectangle(this.backgroundColor, this.x, this.y, this.width, this.height);
131 render.drawText(text, this.font, this.fillColor, (render.width - width) >> 1, this.y);
132 render.end();
133 }
134}
135
136let progressWidth = render.getTextWidth("100%", progressFont); // maximum width

Callers

nothing calls this directly

Calls 5

getTextWidthMethod · 0.80
drawTextMethod · 0.80
beginMethod · 0.65
fillRectangleMethod · 0.65
endMethod · 0.65

Tested by

no test coverage detected