1
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = useOffsetStyle;
|
||||
function useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY) {
|
||||
// >>>>> Offset
|
||||
const AUTO = 'auto';
|
||||
const offsetStyle = isMobile ? {} : {
|
||||
left: '-1000vw',
|
||||
top: '-1000vh',
|
||||
right: AUTO,
|
||||
bottom: AUTO
|
||||
};
|
||||
|
||||
// Set align style
|
||||
if (!isMobile && (ready || !open)) {
|
||||
const {
|
||||
points
|
||||
} = align;
|
||||
const dynamicInset = align.dynamicInset || align._experimental?.dynamicInset;
|
||||
const alignRight = dynamicInset && points[0][1] === 'r';
|
||||
const alignBottom = dynamicInset && points[0][0] === 'b';
|
||||
if (alignRight) {
|
||||
offsetStyle.right = offsetR;
|
||||
offsetStyle.left = AUTO;
|
||||
} else {
|
||||
offsetStyle.left = offsetX;
|
||||
offsetStyle.right = AUTO;
|
||||
}
|
||||
if (alignBottom) {
|
||||
offsetStyle.bottom = offsetB;
|
||||
offsetStyle.top = AUTO;
|
||||
} else {
|
||||
offsetStyle.top = offsetY;
|
||||
offsetStyle.bottom = AUTO;
|
||||
}
|
||||
}
|
||||
return offsetStyle;
|
||||
}
|
||||
Reference in New Issue
Block a user