Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1026][3.0] Window 드래그 시 props로 받은 크기 유지 #1027

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evui",
"version": "3.1.57",
"version": "3.1.58",
"description": "A EXEM Library project",
"author": "exem <dev_client@ex-em.com>",
"license": "MIT",
Expand Down
18 changes: 10 additions & 8 deletions src/components/window/uses.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const useModel = () => {
return result;
};

const removeUnit = (input, direction) => {
const removeUnit = (input, direction = 'horizontal') => {
if (typeof input === 'number') {
return input;
} else if (!input) {
Expand Down Expand Up @@ -226,9 +226,9 @@ const useMouseEvent = (param) => {
const posY = +y - rect.top;
const headerAreaStyleInfo = headerRef.value.style;
const headerPaddingInfo = {
top: removeUnit(headerAreaStyleInfo.paddingTop),
left: removeUnit(headerAreaStyleInfo.paddingLeft),
right: removeUnit(headerAreaStyleInfo.paddingRight),
top: removeUnit(headerAreaStyleInfo.paddingTop, 'vertical'),
left: removeUnit(headerAreaStyleInfo.paddingLeft, 'horizontal'),
right: removeUnit(headerAreaStyleInfo.paddingRight, 'horizontal'),
};
const startPosX = headerPaddingInfo.left;
const endPosX = rect.width - headerPaddingInfo.right;
Expand Down Expand Up @@ -279,17 +279,17 @@ const useMouseEvent = (param) => {
if (hasOwnProperty.call(paramObj, 'minWidth')) {
tMinWidth = paramObj.minWidth;
} else {
tMinWidth = removeUnit(props.minWidth, 'horizontal');
tMinWidth = props.minWidth;
}

if (hasOwnProperty.call(paramObj, 'minHeight')) {
tMinHeight = paramObj.minHeight;
} else {
tMinHeight = removeUnit(props.minHeight, 'vertical');
tMinHeight = props.minHeight;
}

width = Math.max(width, tMinWidth);
height = Math.max(height, tMinHeight);
width = removeUnit(width, 'horizontal') > removeUnit(tMinWidth, 'horizontal') ? width : tMinWidth;
height = removeUnit(height, 'vertical') > removeUnit(tMinHeight, 'vertical') ? height : tMinHeight;

dragStyle.top = numberToUnit(top);
dragStyle.left = numberToUnit(left);
Expand Down Expand Up @@ -433,6 +433,8 @@ const useMouseEvent = (param) => {
setDragStyle({
top: `${tempTop}px`,
left: `${tempLeft}px`,
width: props.width,
height: props.height,
});
} else if (props.resizable && clickedInfo.pressedSpot === 'border') {
resizeWindow(e);
Expand Down