void ofxDatGui::anchorGui() { /* ofGetWidth/ofGetHeight returns incorrect values after retina windows are resized in version 0.9.1 & 0.9.2 https://github.com/openframeworks/openFrameworks/pull/4858 */ int multiplier = 1; if (ofxDatGuiIsRetina() && ofGetVersionMajor() == 0 && ofGetVersionMinor() == 9 && (ofGetVersionPatch() == 1 || ofGetVersionPatch() == 2)){ multiplier = 2; } if (mAnchor == ofxDatGuiAnchor::TOP_LEFT){ mPosition.y = 0; mPosition.x = 0; } else if (mAnchor == ofxDatGuiAnchor::TOP_RIGHT){ mPosition.y = 0; mPosition.x = (ofGetWidth() / multiplier) - mWidth; } else if (mAnchor == ofxDatGuiAnchor::BOTTOM_LEFT){ mPosition.x = 0; mPosition.y = (ofGetHeight() / multiplier) - mHeight; } else if (mAnchor == ofxDatGuiAnchor::BOTTOM_RIGHT){ mPosition.x = (ofGetWidth() / multiplier) - mWidth; mPosition.y = (ofGetHeight() / multiplier) - mHeight; } layoutGui(); }
void ofxDatGui::anchorGui() { mPosition.y = 0; if (mAnchor == ofxDatGuiAnchor::TOP_LEFT){ mPosition.x = 0; } else if (mAnchor == ofxDatGuiAnchor::TOP_RIGHT){ mPosition.x = ofGetWidth() - mWidth; /* ofGetWidth returns an incorrect value after retina windows are resized in version 0.9.1 & 0.9.2 https://github.com/openframeworks/openFrameworks/issues/4746 https://github.com/openframeworks/openFrameworks/pull/4858 */ if (ofxDatGuiIsRetina() && ofGetVersionMajor() == 0 && ofGetVersionMinor() == 9 && (ofGetVersionPatch() == 1 || ofGetVersionPatch() == 2)){ mPosition.x = (ofGetWidth() / 2) - mWidth; } } layoutGui(); }