New source found from dndbeyond.com
This commit is contained in:
+9
-8
@@ -42,8 +42,9 @@ function getOppositeAxis(axis) {
|
||||
function getAxisLength(axis) {
|
||||
return axis === 'y' ? 'height' : 'width';
|
||||
}
|
||||
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
||||
function getSideAxis(placement) {
|
||||
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
||||
return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
|
||||
}
|
||||
function getAlignmentAxis(placement) {
|
||||
return getOppositeAxis(getSideAxis(placement));
|
||||
@@ -68,19 +69,19 @@ function getExpandedPlacements(placement) {
|
||||
function getOppositeAlignmentPlacement(placement) {
|
||||
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
||||
}
|
||||
const lrPlacement = ['left', 'right'];
|
||||
const rlPlacement = ['right', 'left'];
|
||||
const tbPlacement = ['top', 'bottom'];
|
||||
const btPlacement = ['bottom', 'top'];
|
||||
function getSideList(side, isStart, rtl) {
|
||||
const lr = ['left', 'right'];
|
||||
const rl = ['right', 'left'];
|
||||
const tb = ['top', 'bottom'];
|
||||
const bt = ['bottom', 'top'];
|
||||
switch (side) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
if (rtl) return isStart ? rl : lr;
|
||||
return isStart ? lr : rl;
|
||||
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
||||
return isStart ? lrPlacement : rlPlacement;
|
||||
case 'left':
|
||||
case 'right':
|
||||
return isStart ? tb : bt;
|
||||
return isStart ? tbPlacement : btPlacement;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user