void AmplitudeWidget::setCurrentThreshold(double newThreshold, int index) { newThreshold = bound(newThreshold, 0.0, 1.0); if(newThreshold < offsetInv()) setOffset(maxOffset() - newThreshold); else if(newThreshold > offsetInv() + range()) setOffset(maxOffset() - (newThreshold - range())); gdata->setAmpThreshold(gdata->amplitudeMode(), index, (*amp_mode_inv_func[gdata->amplitudeMode()])(newThreshold)); }
void AmplitudeWidget::setOffset(double newOffset) { newOffset = bound(newOffset, 0.0, maxOffset()); //if(_offset != newOffset) { _offset = newOffset; _offsetInv = maxOffset() - _offset; emit offsetChanged(_offset); emit offsetInvChanged(offsetInv()); //} }
void TextAttachment::SetShadow(bool enable, const Vector4& color, const Vector2& offset, const float size) { AllocateTextParameters(); if (enable != mTextParameters->mDropShadowEnabled || color != mTextParameters->mDropShadowColor || offset != mTextParameters->mDropShadow || fabsf(size - mTextParameters->mDropShadowSize) > Math::MACHINE_EPSILON_1 ) { mTextParameters->SetShadow( enable, color, offset, size ); const float unitPointSize( 64.0f ); const float unitsToPixels( mFont->GetUnitsToPixels()); const float fontPointSize( mFont->GetPointSize() ); float shadowSize( (size * 0.25f) / unitsToPixels ); Vector2 shadowOffset( offset ); Vector2 maxOffset( fontPointSize / 4.5f, fontPointSize / 4.5f ); shadowOffset = Min( shadowOffset, maxOffset ); shadowOffset = Max( shadowOffset, -maxOffset ); shadowOffset *= unitPointSize / fontPointSize; SetDropShadowMessage( mStage->GetUpdateInterface(), *mSceneObject, enable, color, shadowOffset, shadowSize ); } }
Position VisiblePosition::rangeCompliantEquivalent(const Position &pos) { NodeImpl *node = pos.node(); if (!node) return Position(); // FIXME: This clamps out-of-range values. // Instead we should probably assert, and not use such values. long offset = pos.offset(); if (!offsetInCharacters(node->nodeType()) && isAtomicNode(node) && offset > 0) return Position(node->parentNode(), node->nodeIndex() + 1); return Position(node, kMax(0L, kMin(offset, maxOffset(node)))); }