提交 96a36393 编写于 作者: O openharmony_ci 提交者: Gitee

!227 修复图形告警,修改滚动条贝塞尔曲线参数

Merge pull request !227 from YueBiang/bar
......@@ -73,7 +73,7 @@ private:
}
float bezielY = opa;
bezielY =
Interpolation::GetBezierY(bezielY / OPA_OPAQUE, 0, BEZIER_CONTROL_POINT_Y_1, BEZIER_CONTROL_POINT_X_2, 1);
Interpolation::GetBezierY(bezielY / OPA_OPAQUE, BEZIER_CONTROL_POINT_X_1, 0, BEZIER_CONTROL_POINT_X_2, 1);
opa = static_cast<uint8_t>(bezielY * opa);
if (scrollView_.yScrollBarVisible_) {
scrollView_.yScrollBar_->SetOpacity(opa);
......@@ -114,7 +114,7 @@ private:
}
static constexpr uint16_t ANIMATOR_DURATION = 250;
static constexpr uint16_t APPEAR_PERIOD = 2000;
static constexpr float BEZIER_CONTROL_POINT_Y_1 = 0.33f;
static constexpr float BEZIER_CONTROL_POINT_X_1 = 0.33f;
static constexpr float BEZIER_CONTROL_POINT_X_2 = 0.67f;
UIAbstractScroll& scrollView_;
GraphicTimer timer_;
......
......@@ -120,30 +120,30 @@ void UISlider::SetKnobImage(const char* knobImage)
void UISlider::DrawKnob(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, const Rect& foregroundRect)
{
int16_t halfKnobWidth = GetKnobWidth() >> 1;
int16_t halfKnobWidth = GetKnobWidth() / 2; // 2: half
int16_t offset;
Rect knobBar;
switch (direction_) {
case Direction::DIR_LEFT_TO_RIGHT: {
offset = (knobWidth_ - progressHeight_) >> 1;
offset = (knobWidth_ - progressHeight_) / 2; // 2: half
knobBar.SetRect(foregroundRect.GetRight() - halfKnobWidth, foregroundRect.GetTop() - offset,
foregroundRect.GetRight() + halfKnobWidth, foregroundRect.GetBottom() + offset);
break;
}
case Direction::DIR_RIGHT_TO_LEFT: {
offset = (knobWidth_ - progressHeight_) >> 1;
offset = (knobWidth_ - progressHeight_) / 2; // 2: half
knobBar.SetRect(foregroundRect.GetLeft() - halfKnobWidth, foregroundRect.GetTop() - offset,
foregroundRect.GetLeft() + halfKnobWidth, foregroundRect.GetBottom() + offset);
break;
}
case Direction::DIR_BOTTOM_TO_TOP: {
offset = (knobWidth_ - progressWidth_) >> 1;
offset = (knobWidth_ - progressWidth_) / 2; // 2: half
knobBar.SetRect(foregroundRect.GetLeft() - offset, foregroundRect.GetTop() - halfKnobWidth,
foregroundRect.GetRight() + offset, foregroundRect.GetTop() + halfKnobWidth);
break;
}
case Direction::DIR_TOP_TO_BOTTOM: {
offset = (knobWidth_ - progressWidth_) >> 1;
offset = (knobWidth_ - progressWidth_) / 2; // 2: half
knobBar.SetRect(foregroundRect.GetLeft() - offset, foregroundRect.GetBottom() - halfKnobWidth,
foregroundRect.GetRight() + offset, foregroundRect.GetBottom() + halfKnobWidth);
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册