UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

17 lines (16 loc) 928 B
import { boolToInt } from '@devexpress/utils/lib/utils/common'; import { PictureSize } from '../../../../floating-objects/sizes'; import { JSONAnchorInlineBaseSize, JSONPictureSize } from '../../../enums/json-floating-enums'; import { SizeExporter } from '../../json-importer'; export class JSONInlinePictureSizeConverterConverter { static convertFromJSON(obj, cacheInfo) { return new PictureSize(!!obj[JSONAnchorInlineBaseSize.LockAspectRatio], obj[JSONAnchorInlineBaseSize.Rotation], cacheInfo, SizeExporter.convertFromJSON(obj[JSONPictureSize.Scale])); } static convertToJSON(source) { const result = {}; result[JSONAnchorInlineBaseSize.LockAspectRatio] = boolToInt(source.lockAspectRatio); result[JSONAnchorInlineBaseSize.Rotation] = source.rotation; result[JSONPictureSize.Scale] = SizeExporter.convertToJSON(source.scale); return result; } }