UNPKG

@kitware/vtk.js

Version:

Visualization Toolkit for the Web

61 lines (46 loc) 2.02 kB
import { m as macro } from '../../macros2.js'; import vtkProperty2D from './Property2D.js'; // ---------------------------------------------------------------------------- // vtkTextProperty methods // ---------------------------------------------------------------------------- function vtkTextProperty(publicAPI, model) { // Set our className model.classHierarchy.push('vtkTextProperty'); } // ---------------------------------------------------------------------------- // Object factory // ---------------------------------------------------------------------------- const DEFAULT_VALUES = { fontFamily: 'Arial', fontColor: [0, 0, 0], fontStyle: 'normal', // backgroundColor: [1, 1, 1], // Scales the font size based on the given resolution. // Dividing by 1.8 ensures the font size is proportionate and not too large. // The value 1.8 is a chosen scaling factor for visual balance. fontSizeScale: resolution => resolution / 1.8, resolution: 200 // shadowColor: [1, 1, 0], // shadowOffset: [1, -1], // shadowBlur: 0, }; // ---------------------------------------------------------------------------- function extend(publicAPI, model, initialValues = {}) { Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance vtkProperty2D.extend(publicAPI, model, initialValues); // Build VTK API macro.setGet(publicAPI, model, ['fontFamily', 'fontStyle', 'fillStyle', 'fontSizeScale', 'resolution', 'shadowBlur']); macro.setGetArray(publicAPI, model, ['shadowOffset'], 2); macro.setGetArray(publicAPI, model, ['backgroundColor', 'fontColor', 'shadowColor'], 3); // Object methods vtkTextProperty(publicAPI, model); } // ---------------------------------------------------------------------------- const newInstance = macro.newInstance(extend, 'vtkTextProperty'); // ---------------------------------------------------------------------------- var vtkTextProperty$1 = { newInstance, extend }; export { vtkTextProperty$1 as default, extend, newInstance };