mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-12-13 18:07:35 +00:00
!1575 修改自由窗口最小尺寸限制,横竖屏统一为320*240(vp)
Merge pull request !1575 from liuqi/lq_0919
This commit is contained in:
commit
c198a5a95f
@ -159,12 +159,8 @@ Rect WindowTestUtils::CalcLimitedRect(const Rect& rect, float virtualPixelRatio)
|
||||
{
|
||||
constexpr uint32_t maxLimitLen = 2560;
|
||||
constexpr int32_t maxPosRemain = 48;
|
||||
uint32_t minVerticalFloatingW = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minVerticalFloatingH = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
|
||||
bool vertical = displayRect_.width_ < displayRect_.height_;
|
||||
uint32_t minFloatingW = vertical ? minVerticalFloatingW : minVerticalFloatingH;
|
||||
uint32_t minFloatingH = vertical ? minVerticalFloatingH : minVerticalFloatingW;
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minFloatingH = static_cast<uint32_t>(MIN_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
Rect resRect = {
|
||||
std::min(std::max(rect.posX_, maxPosRemain - static_cast<int32_t>(rect.width_)),
|
||||
static_cast<int32_t>(displayRect_.width_) - maxPosRemain),
|
||||
@ -177,12 +173,8 @@ Rect WindowTestUtils::CalcLimitedRect(const Rect& rect, float virtualPixelRatio)
|
||||
|
||||
Rect WindowTestUtils::GetFloatingLimitedRect(const Rect& rect, float virtualPixelRatio)
|
||||
{
|
||||
uint32_t minVerticalFloatingW = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minVerticalFloatingH = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
bool vertical = displayRect_.width_ < displayRect_.height_;
|
||||
|
||||
uint32_t minFloatingW = vertical ? minVerticalFloatingW : minVerticalFloatingH;
|
||||
uint32_t minFloatingH = vertical ? minVerticalFloatingH : minVerticalFloatingW;
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minFloatingH = static_cast<uint32_t>(MIN_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
Rect resRect = {
|
||||
rect.posX_,
|
||||
rect.posY_,
|
||||
@ -208,7 +200,6 @@ Rect WindowTestUtils::GetDecorateRect(const Rect& rect, float virtualPixelRatio)
|
||||
void WindowTestUtils::InitByDisplayRect(const Rect& displayRect)
|
||||
{
|
||||
const float barRatio = 0.07;
|
||||
const float appRation = 0.6;
|
||||
const float spaceRation = 0.125;
|
||||
displayRect_ = displayRect;
|
||||
limitDisplayRect_ = displayRect;
|
||||
@ -221,8 +212,8 @@ void WindowTestUtils::InitByDisplayRect(const Rect& displayRect)
|
||||
customAppRect_ = {
|
||||
displayRect_.width_ * spaceRation,
|
||||
displayRect_.height_ * spaceRation,
|
||||
displayRect_.width_ * appRation,
|
||||
displayRect_.height_ * appRation
|
||||
displayRect_.width_ * DEFAULT_ASPECT_RATIO,
|
||||
displayRect_.height_ * DEFAULT_ASPECT_RATIO
|
||||
};
|
||||
}
|
||||
|
||||
@ -248,8 +239,7 @@ uint32_t WindowTestUtils::GetMaxTileWinNum()
|
||||
constexpr uint32_t half = 2;
|
||||
uint32_t edgeIntervalVp = static_cast<uint32_t>(EDGE_INTERVAL * half * virtualPixelRatio);
|
||||
uint32_t midIntervalVp = static_cast<uint32_t>(MID_INTERVAL * virtualPixelRatio);
|
||||
uint32_t minFloatingW = isVerticalDisplay_ ? MIN_VERTICAL_FLOATING_WIDTH : MIN_VERTICAL_FLOATING_HEIGHT;
|
||||
minFloatingW = static_cast<uint32_t>(minFloatingW * virtualPixelRatio);
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t drawableW = limitDisplayRect_.width_ - edgeIntervalVp + midIntervalVp;
|
||||
uint32_t maxNum = static_cast<uint32_t>(drawableW / (minFloatingW + midIntervalVp));
|
||||
WLOGFI("maxNum: %{public}d", maxNum);
|
||||
|
@ -207,17 +207,12 @@ public:
|
||||
static Rect GetFixedWindowRectByLimitSize(const Rect& oriDstRect, const Rect& lastRect, bool isVertical,
|
||||
float virtualPixelRatio)
|
||||
{
|
||||
uint32_t minVerticalFloatingW = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minVerticalFloatingH = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t minFloatingH = static_cast<uint32_t>(MIN_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
Rect dstRect = oriDstRect;
|
||||
// fix minimum size
|
||||
if (isVertical) {
|
||||
dstRect.width_ = std::max(minVerticalFloatingW, oriDstRect.width_);
|
||||
dstRect.height_ = std::max(minVerticalFloatingH, oriDstRect.height_);
|
||||
} else {
|
||||
dstRect.width_ = std::max(minVerticalFloatingH, oriDstRect.width_);
|
||||
dstRect.height_ = std::max(minVerticalFloatingW, oriDstRect.height_);
|
||||
}
|
||||
dstRect.width_ = std::max(minFloatingW, oriDstRect.width_);
|
||||
dstRect.height_ = std::max(minFloatingH, oriDstRect.height_);
|
||||
|
||||
// fix maximum size
|
||||
dstRect.width_ = std::min(static_cast<uint32_t>(MAX_FLOATING_SIZE * virtualPixelRatio), dstRect.width_);
|
||||
|
@ -326,7 +326,7 @@ struct AbilityInfo {
|
||||
|
||||
namespace {
|
||||
constexpr float DEFAULT_SPLIT_RATIO = 0.5;
|
||||
constexpr float DEFAULT_ASPECT_RATIO = 0.66;
|
||||
constexpr float DEFAULT_ASPECT_RATIO = 0.67;
|
||||
constexpr float DISPLAY_ZOOM_OFF_SCALE = 1.0;
|
||||
constexpr float DISPLAY_ZOOM_MIN_SCALE = 2.0;
|
||||
constexpr float DISPLAY_ZOOM_MAX_SCALE = 8.0;
|
||||
@ -337,8 +337,8 @@ namespace {
|
||||
constexpr uint32_t WINDOW_FRAME_CORNER_WIDTH = 16; // the frame width of corner
|
||||
constexpr uint32_t HOTZONE_TOUCH = 20;
|
||||
constexpr uint32_t HOTZONE_POINTER = 4;
|
||||
constexpr uint32_t MIN_VERTICAL_FLOATING_WIDTH = 240;
|
||||
constexpr uint32_t MIN_VERTICAL_FLOATING_HEIGHT = 320;
|
||||
constexpr uint32_t MIN_FLOATING_WIDTH = 320;
|
||||
constexpr uint32_t MIN_FLOATING_HEIGHT = 240;
|
||||
constexpr uint32_t MIN_VERTICAL_SPLIT_HEIGHT = 240;
|
||||
constexpr uint32_t MIN_HORIZONTAL_SPLIT_WIDTH = 320;
|
||||
constexpr uint32_t MAX_FLOATING_SIZE = 2560;
|
||||
|
@ -589,11 +589,8 @@ WindowSizeLimits WindowLayoutPolicy::GetSystemSizeLimits(const sptr<WindowNode>&
|
||||
}
|
||||
systemLimits.minHeight_ = static_cast<uint32_t>(systemLimits.minWidth_ * hwRatio);
|
||||
} else {
|
||||
systemLimits.minWidth_ = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_WIDTH * virtualPixelRatio);
|
||||
systemLimits.minHeight_ = static_cast<uint32_t>(MIN_VERTICAL_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
if (displayRect.width_ > displayRect.height_ && !node->isShowingOnMultiDisplays_) {
|
||||
std::swap(systemLimits.minWidth_, systemLimits.minHeight_);
|
||||
}
|
||||
systemLimits.minWidth_ = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
systemLimits.minHeight_ = static_cast<uint32_t>(MIN_FLOATING_HEIGHT * virtualPixelRatio);
|
||||
}
|
||||
WLOGFD("[System SizeLimits] [maxWidth: %{public}u, minWidth: %{public}u, maxHeight: %{public}u, "
|
||||
"minHeight: %{public}u]", systemLimits.maxWidth_, systemLimits.minWidth_,
|
||||
|
@ -73,8 +73,7 @@ uint32_t WindowLayoutPolicyTile::GetMaxTileWinNum(DisplayId displayId) const
|
||||
constexpr uint32_t half = 2;
|
||||
uint32_t edgeIntervalVp = static_cast<uint32_t>(EDGE_INTERVAL * half * virtualPixelRatio);
|
||||
uint32_t midIntervalVp = static_cast<uint32_t>(MID_INTERVAL * virtualPixelRatio);
|
||||
uint32_t minFloatingW = IsVerticalDisplay(displayId) ? MIN_VERTICAL_FLOATING_WIDTH : MIN_VERTICAL_FLOATING_HEIGHT;
|
||||
minFloatingW = static_cast<uint32_t>(minFloatingW * virtualPixelRatio);
|
||||
uint32_t minFloatingW = static_cast<uint32_t>(MIN_FLOATING_WIDTH * virtualPixelRatio);
|
||||
uint32_t drawableW = limitRectMap_[displayId].width_ - edgeIntervalVp + midIntervalVp;
|
||||
return static_cast<uint32_t>(drawableW / (minFloatingW + midIntervalVp));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user