Exemple #1
0
//--------------------------------------------------------------
void testApp::drawVertAlignMark(const ofRectangle& rect, const ofColor& color, ofAlignVert vAlign) {
    if(vAlign != OF_ALIGN_VERT_IGNORE) {
        float vAnchor = rect.getVertAnchor(vAlign);
        ofSetColor(color,120);
        ofLine(rect.getLeft()  - 13, vAnchor, rect.getLeft()  - 3, vAnchor);
        ofLine(rect.getRight() + 13, vAnchor, rect.getRight() + 3, vAnchor);
    }
}
//----------------------------------------------------------
void ofRectangle::alignToVert(const ofRectangle& targetRect,
                              ofAlignVert targetVertAnchor,
                              ofAlignVert thisVertAnchor) {

    if(targetVertAnchor != OF_ALIGN_VERT_IGNORE &&
            thisVertAnchor   != OF_ALIGN_VERT_IGNORE) {
        alignToVert(targetRect.getVertAnchor(targetVertAnchor),thisVertAnchor);
    } else {
        if(targetVertAnchor == OF_ALIGN_VERT_IGNORE) {
            ofLogVerbose("ofRectangle") << "alignToVert(): targetVertAnchor == OF_ALIGN_VERT_IGNORE, no alignment applied";
        } else {
            ofLogVerbose("ofRectangle") << "alignToVert(): thisVertAnchor == OF_ALIGN_VERT_IGNORE, no alignment applied";
        }

    }
}