2020-06-10 15:24:42 +02:00
|
|
|
import defaultValues from '../objects/defaultValues.js'
|
2020-06-12 10:04:59 +02:00
|
|
|
import Components from '../objects/components.js'
|
2020-06-10 15:24:42 +02:00
|
|
|
import getStyleForProperty from '../process/getStyleForProperty.js'
|
|
|
|
import trueDimension from '../util/trueDimension.js'
|
2020-06-20 11:23:25 +02:00
|
|
|
import units from '../interpolation/units.js'
|
2020-06-16 16:40:58 +02:00
|
|
|
import {textPropOnStart} from './textPropertiesBase.js'
|
2020-06-09 22:06:26 +02:00
|
|
|
|
2020-06-16 16:40:58 +02:00
|
|
|
// const textProperties = { category : 'textProperties', defaultValues: [], interpolators: {units} }, functions = { prepareStart, prepareProperty, onStart:{} }
|
2020-06-09 22:06:26 +02:00
|
|
|
|
|
|
|
// Component Properties
|
2020-06-16 16:40:58 +02:00
|
|
|
const textProps = ['fontSize','lineHeight','letterSpacing','wordSpacing']
|
2020-06-09 22:06:26 +02:00
|
|
|
const textOnStart = {}
|
|
|
|
|
2020-06-16 16:40:58 +02:00
|
|
|
// Component Functions
|
|
|
|
textProps.forEach(tweenProp => {
|
2020-06-09 22:06:26 +02:00
|
|
|
textOnStart[tweenProp] = textPropOnStart
|
|
|
|
})
|
|
|
|
export function getTextProp(prop) {
|
|
|
|
return getStyleForProperty(this.element,prop) || defaultValues[prop];
|
|
|
|
}
|
|
|
|
export function prepareTextProp(prop,value) {
|
|
|
|
return trueDimension(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// All Component Functions
|
|
|
|
const textPropFunctions = {
|
|
|
|
prepareStart: getTextProp,
|
|
|
|
prepareProperty: prepareTextProp,
|
|
|
|
onStart: textOnStart
|
|
|
|
}
|
|
|
|
|
|
|
|
// Component Full
|
2020-06-16 16:40:58 +02:00
|
|
|
const textProperties = {
|
2020-06-09 22:06:26 +02:00
|
|
|
component: 'textProperties',
|
2020-06-16 16:40:58 +02:00
|
|
|
category: 'textProperties',
|
|
|
|
properties: textProps,
|
2020-06-09 22:06:26 +02:00
|
|
|
defaultValues: {fontSize:0,lineHeight:0,letterSpacing:0,wordSpacing:0},
|
|
|
|
Interpolate: {units},
|
|
|
|
functions: textPropFunctions,
|
|
|
|
Util: {trueDimension}
|
|
|
|
}
|
|
|
|
|
2020-06-16 16:40:58 +02:00
|
|
|
export default textProperties
|
|
|
|
|
|
|
|
Components.TextProperties = textProperties
|