function calculateYPosition(layers, layer) {
	      // Get the layer's currently configured Y position
	      var attachYLayerPosition = this.getLayerValue(layers, layer, 'y');

	      // If this is an object and has the attach property
	      if ((typeof attachYLayerPosition === 'undefined' ? 'undefined' : _typeof(attachYLayerPosition)) === 'object' && attachYLayerPosition.attach !== 'undefined') {
	        // Get the layer to attach to
	        var attachYLayer = layers[layer.y.attach];

	        // Calculate the Y offset
	        var attachYLayerHeight = 0;
	        switch (attachYLayer.type) {
	          case 'text':
	            var attachYLayerText = attachYLayer.text.split('\n');
	            if (attachYLayer.text !== '') {
	              attachYLayerHeight = attachYLayerText.length * (this.getLayerValue(layers, attachYLayer, 'lineHeight') || this.getLayerValue(layers, attachYLayer, 'fontSize'));
	            }
	            break;
	          default:
	            if (typeof this.getLayerValue(layers, attachYLayer, 'height') !== 'undefined') {
	              attachYLayerHeight = this.getLayerValue(layers, attachYLayer, 'height');
	            }
	            break;
	        }

	        // Add any additionally configured offset value
	        var attachYLayerOffset = layer.y.offset || 0;

	        // Add them together and recursively call this function if the next layer has an attachment
	        attachYLayerPosition = attachYLayerHeight + this.calculateYPosition(layers, attachYLayer) + attachYLayerOffset;
	      }

	      // Return the value
	      return attachYLayerPosition;
	    }
/**
	     * Calculates the Y position of an element based on any attachments etc.
	     *
	     * @param {object} layers - The object of all layers
	     * @param {object} layer - The layer to calculate the Y position for
	     *
	     * @return {integer} The Y position
	     */
Calculates the Y position of an element based on any attachments etc.
@param {object} layers - The object of all layers
@param {object} layer - The layer to calculate the Y position for

@return {integer} The Y position
Calculates the Y position of an element based on any attachments etc . @param { object } layers - The object of all layers @param { object } layer - The layer to calculate the Y position for @return { integer } The Y position
function calculateYPosition(layers, layer) {
	      var attachYLayerPosition = this.getLayerValue(layers, layer, 'y');
	      if ((typeof attachYLayerPosition === 'undefined' ? 'undefined' : _typeof(attachYLayerPosition)) === 'object' && attachYLayerPosition.attach !== 'undefined') {
	        var attachYLayer = layers[layer.y.attach];
	        var attachYLayerHeight = 0;
	        switch (attachYLayer.type) {
	          case 'text':
	            var attachYLayerText = attachYLayer.text.split('\n');
	            if (attachYLayer.text !== '') {
	              attachYLayerHeight = attachYLayerText.length * (this.getLayerValue(layers, attachYLayer, 'lineHeight') || this.getLayerValue(layers, attachYLayer, 'fontSize'));
	            }
	            break;
	          default:
	            if (typeof this.getLayerValue(layers, attachYLayer, 'height') !== 'undefined') {
	              attachYLayerHeight = this.getLayerValue(layers, attachYLayer, 'height');
	            }
	            break;
	        }
	        var attachYLayerOffset = layer.y.offset || 0;
	        attachYLayerPosition = attachYLayerHeight + this.calculateYPosition(layers, attachYLayer) + attachYLayerOffset;
	      }
	      return attachYLayerPosition;
	    }
function calculateYPosition ( layers , layer ) { var attachYLayerPosition = this . getLayerValue ( layers , layer , 'y' ) ; if ( ( typeof attachYLayerPosition === 'undefined' ? 'undefined' : _typeof ( attachYLayerPosition ) ) === 'object' && attachYLayerPosition . attach !== 'undefined' ) { var attachYLayer = layers [ layer . y . attach ] ; var attachYLayerHeight = 0 ; switch ( attachYLayer . type ) { case 'text' : var attachYLayerText = attachYLayer . text . split ( '\n' ) ; if ( attachYLayer . text !== '' ) { attachYLayerHeight = attachYLayerText . length * ( this . getLayerValue ( layers , attachYLayer , 'lineHeight' ) || this . getLayerValue ( layers , attachYLayer , 'fontSize' ) ) ; } break ; default : if ( typeof this . getLayerValue ( layers , attachYLayer , 'height' ) !== 'undefined' ) { attachYLayerHeight = this . getLayerValue ( layers , attachYLayer , 'height' ) ; } break ; } var attachYLayerOffset = layer . y . offset || 0 ; attachYLayerPosition = attachYLayerHeight + this . calculateYPosition ( layers , attachYLayer ) + attachYLayerOffset ; } return attachYLayerPosition ; }
Calculates the Y position of an element based on any attachments etc.
Calculates the Y position of an element based on any attachments etc .
// Get the layer's currently configured Y position // If this is an object and has the attach property // Get the layer to attach to // Calculate the Y offset // Add any additionally configured offset value // Add them together and recursively call this function if the next layer has an attachment // Return the value