import {Unit} from "../../../drawing/Unit"; import {observable} from "mobx/lib/mobx"; /** * Created by TonyJiang on 16/8/24. */ export class Font { // @observable private _fontFamily:string = 'Arial'; // @observable private _fontSize:Unit = Unit.pixel(12); // @observable private _fontColor:any = 'rgba(0, 0, 0, 1)'; // @observable private _isBold:boolean = false; // @observable private _isItalic:boolean = false; // @observable private _isUnderline:boolean = false; // @observable private _isStrikeThrough:boolean = false; static getFields() { return [ { name: 'fontFamily', type: 'string', }, { name: 'fontSize', type: 'Unit' }, { name: 'fontColor', type: 'string' }, { name: 'isBold', type: 'boolean' }, { name: 'isItalic', type: 'boolean' }, { name: 'isUnderline', type: 'boolean' }, { name: 'isStrikeThrough', type: 'boolean' } ]; } clone():Font { const clone = new Font(); clone.fontFamily = this.fontFamily; clone.fontSize = this.fontSize; clone.fontColor = this.fontColor; clone.isBold = this.isBold; clone.isItalic = this.isItalic; clone.isUnderline = this.isUnderline; clone.isStrikeThrough = this.isStrikeThrough; return clone; } get fontFamily():string { return this._fontFamily; } set fontFamily(value:string) { this._fontFamily = value; } get fontSize():Unit { return this._fontSize; } set fontSize(value:Unit) { this._fontSize = value; } get fontColor():any { return this._fontColor; } set fontColor(value:any) { this._fontColor = value; } get isBold():boolean { return this._isBold; } set isBold(value:boolean) { this._isBold = value; } get isItalic():boolean { return this._isItalic; } set isItalic(value:boolean) { this._isItalic = value; } get isUnderline():boolean { return this._isUnderline; } set isUnderline(value:boolean) { this._isUnderline = value; } get isStrikeThrough():boolean { return this._isStrikeThrough; } set isStrikeThrough(value:boolean) { this._isStrikeThrough = value; } }