MCPcopy Index your code
hub / github.com/devforth/painterro / constructor

Method constructor

js/text.js:6–31  ·  view source on GitHub ↗
(main)

Source from the content-addressed store, hash-verified

4
5export default class TextTool {
6 constructor(main) {
7 this.ctx = main.ctx;
8 this.el = main.toolContainer;
9 this.main = main;
10 this.wrapper = main.wrapper;
11 this.input = this.el.querySelector('.ptro-text-tool-input');
12 this.inputWrapper = this.el.querySelector('.ptro-text-tool-input-wrapper');
13 this.inputWrapper.style.display = 'none';
14 this.isBold = main.params.defaultFontBold;
15 this.isItalic = main.params.defaultFontItalic;
16 this.strokeOn = main.params.defaultTextStrokeAndShadow;
17
18 this.strokeColor = main.params.textStrokeAlphaColor;
19 this.setFontSize(main.params.defaultFontSize);
20 this.setFont(this.getFonts()[0].value);
21 this.setFontIsBold(this.isBold);
22 this.setFontIsItalic(this.isItalic);
23
24 this.el.querySelector('.ptro-text-tool-apply').onclick = () => {
25 this.apply();
26 };
27
28 this.el.querySelector('.ptro-text-tool-cancel').onclick = () => {
29 this.close();
30 };
31 }
32
33 getFont() {
34 return this.font;

Callers

nothing calls this directly

Calls 7

setFontSizeMethod · 0.95
setFontMethod · 0.95
getFontsMethod · 0.95
setFontIsBoldMethod · 0.95
setFontIsItalicMethod · 0.95
applyMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected