MCPcopy Create free account
hub / github.com/SpartanJ/eepp / getPropertyRelativeTargetContainerLength

Method getPropertyRelativeTargetContainerLength

src/eepp/ui/uinode.cpp:1565–1621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1563}
1564
1565Float UINode::getPropertyRelativeTargetContainerLength(
1566 const PropertyRelativeTarget& relativeTarget, const Float& defaultValue,
1567 const Uint32& propertyIndex ) const {
1568 Float containerLength = defaultValue;
1569 switch ( relativeTarget ) {
1570 case PropertyRelativeTarget::ContainingBlockWidth: {
1571 Node* parent = getParent(); // Text spans cannot be considered containing blocks
1572 while ( parent->isType( UI_TYPE_TEXTSPAN ) )
1573 parent = parent->getParent();
1574 containerLength = parent ? parent->getPixelsSize().getWidth() : 0;
1575 break;
1576 }
1577 case PropertyRelativeTarget::ContainingBlockHeight: {
1578 Node* parent = getParent(); // Text spans cannot be considered containing blocks
1579 while ( parent->isType( UI_TYPE_TEXTSPAN ) )
1580 parent = parent->getParent();
1581 containerLength = parent ? parent->getPixelsSize().getHeight() : 0;
1582 break;
1583 }
1584 case PropertyRelativeTarget::LocalBlockWidth:
1585 containerLength = getPixelsSize().getWidth();
1586 break;
1587 case PropertyRelativeTarget::LocalBlockHeight:
1588 containerLength = getPixelsSize().getHeight();
1589 break;
1590 case PropertyRelativeTarget::BackgroundWidth:
1591 containerLength =
1592 getPixelsSize().getWidth() -
1593 getBackground()->getLayer( propertyIndex )->getDrawableSize().getWidth();
1594 break;
1595 case PropertyRelativeTarget::BackgroundHeight:
1596 containerLength =
1597 getPixelsSize().getHeight() -
1598 getBackground()->getLayer( propertyIndex )->getDrawableSize().getHeight();
1599 break;
1600 case PropertyRelativeTarget::ForegroundWidth:
1601 containerLength =
1602 getPixelsSize().getWidth() -
1603 getForeground()->getLayer( propertyIndex )->getDrawableSize().getWidth();
1604 break;
1605 case PropertyRelativeTarget::ForegroundHeight:
1606 containerLength =
1607 getPixelsSize().getHeight() -
1608 getForeground()->getLayer( propertyIndex )->getDrawableSize().getHeight();
1609 break;
1610 case PropertyRelativeTarget::LocalBlockRadiusWidth:
1611 containerLength = getPixelsSize().getWidth() * 0.5f;
1612 break;
1613 case PropertyRelativeTarget::LocalBlockRadiusHeight:
1614 containerLength = getPixelsSize().getHeight() * 0.5f;
1615 break;
1616 case PropertyRelativeTarget::None:
1617 default:
1618 break;
1619 }
1620 return containerLength;
1621}
1622

Callers 1

tweenPropertyMethod · 0.80

Calls 7

getParentFunction · 0.85
isTypeMethod · 0.45
getParentMethod · 0.45
getWidthMethod · 0.45
getPixelsSizeMethod · 0.45
getHeightMethod · 0.45
getLayerMethod · 0.45

Tested by

no test coverage detected