MCPcopy Create free account
hub / github.com/Snapchat/Valdi / convertRectToParent

Method convertRectToParent

snap_drawing/src/snap_drawing/cpp/Layers/Layer.cpp:887–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887Rect Layer::convertRectToParent(const Rect& rect) {
888 // TODO(simon): Take in account rotation
889
890 if (_hasScale) {
891 auto convertedRect =
892 Rect::makeXYWH(rect.left * _scaleX, rect.top * _scaleY, rect.width() * _scaleX, rect.height() * _scaleY);
893
894 auto offset = getOffsetInParent();
895 return convertedRect.makeOffset(offset.x, offset.y);
896 } else {
897 return rect.makeOffset(_frame.left + _translation.width, _frame.top + _translation.height);
898 }
899}
900
901Point Layer::convertPointToParent(const Point& point) {
902 // TODO(simon): Take in account rotation

Callers 1

Calls 3

widthMethod · 0.45
heightMethod · 0.45
makeOffsetMethod · 0.45

Tested by

no test coverage detected