mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-22 01:28:12 +08:00
Rename and organize widget components to conform to design terminology (#132)
This commit is contained in:
@@ -1,19 +1,6 @@
|
||||
<template>
|
||||
<div class="working-colors">
|
||||
<div class="swatch-pair">
|
||||
<div class="secondary swatch">
|
||||
<button @click="clickSecondarySwatch" style="background: white"></button>
|
||||
<PopoverMount :direction="PopoverDirection.Right" horizontal ref="secondarySwatchPopover">
|
||||
<ColorPicker />
|
||||
</PopoverMount>
|
||||
</div>
|
||||
<div class="primary swatch">
|
||||
<button @click="clickPrimarySwatch" style="background: black"></button>
|
||||
<PopoverMount :direction="PopoverDirection.Right" horizontal ref="primarySwatchPopover">
|
||||
<ColorPicker />
|
||||
</PopoverMount>
|
||||
</div>
|
||||
</div>
|
||||
<SwatchPairInput />
|
||||
<div class="swap-and-reset">
|
||||
<IconButton :size="16">
|
||||
<SwapButton />
|
||||
@@ -27,40 +14,6 @@
|
||||
|
||||
<style lang="scss">
|
||||
.working-colors {
|
||||
.swatch-pair {
|
||||
display: flex;
|
||||
// Reversed order of elements paired with `column-reverse` allows primary to overlap secondary without relying on `z-index`
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.swatch {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin: 2px;
|
||||
position: relative;
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 2px #888 solid;
|
||||
box-shadow: 0 0 0 2px #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.popover-mount {
|
||||
top: 50%;
|
||||
right: -2px;
|
||||
}
|
||||
|
||||
&.primary {
|
||||
margin-bottom: -8px;
|
||||
}
|
||||
}
|
||||
|
||||
.swap-and-reset {
|
||||
font-size: 0;
|
||||
}
|
||||
@@ -69,34 +22,17 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import PopoverMount, { PopoverDirection } from "./PopoverMount.vue";
|
||||
import ColorPicker from "../popovers/ColorPicker.vue";
|
||||
import IconButton from "./IconButton.vue";
|
||||
import SwatchPairInput from "./inputs/SwatchPairInput.vue";
|
||||
import IconButton from "./buttons/IconButton.vue";
|
||||
import SwapButton from "../../../assets/svg/16x16-bounds-12x12-icon/swap.svg";
|
||||
import ResetColorsButton from "../../../assets/svg/16x16-bounds-12x12-icon/reset-colors.svg";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
PopoverMount,
|
||||
ColorPicker,
|
||||
SwatchPairInput,
|
||||
IconButton,
|
||||
SwapButton,
|
||||
ResetColorsButton,
|
||||
},
|
||||
methods: {
|
||||
clickPrimarySwatch() {
|
||||
(this.$refs.primarySwatchPopover as typeof PopoverMount).setOpen();
|
||||
(this.$refs.secondarySwatchPopover as typeof PopoverMount).setClosed();
|
||||
},
|
||||
clickSecondarySwatch() {
|
||||
(this.$refs.secondarySwatchPopover as typeof PopoverMount).setOpen();
|
||||
(this.$refs.primarySwatchPopover as typeof PopoverMount).setClosed();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
PopoverDirection,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
+6
-1
@@ -18,10 +18,15 @@
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
||||
&:not(.gap-after) + .icon-button {
|
||||
// The `where` pseduo-class does not contribtue to specificity
|
||||
& + :where(.icon-button) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
&.gap-after + .icon-button {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #666;
|
||||
color: white;
|
||||
+12
-12
@@ -1,23 +1,23 @@
|
||||
<template>
|
||||
<div class="dropdown-button">
|
||||
<div class="popover-button">
|
||||
<button @click="clickButton">
|
||||
<component :is="icon" />
|
||||
</button>
|
||||
<PopoverMount :direction="PopoverDirection.Bottom" ref="popover">
|
||||
<Popover :direction="PopoverDirection.Bottom" ref="popover">
|
||||
<slot></slot>
|
||||
</PopoverMount>
|
||||
</Popover>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.dropdown-button {
|
||||
.popover-button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 16px;
|
||||
height: 24px;
|
||||
margin: 2px 4px;
|
||||
|
||||
.popover-mount {
|
||||
.popover {
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import DropdownArrow from "../../../assets/svg/16x24-bounds-8x16-icon/dropdown-arrow.svg";
|
||||
import VerticalEllipsis from "../../../assets/svg/16x24-bounds-8x16-icon/vertical-ellipsis.svg";
|
||||
import PopoverMount, { PopoverDirection } from "./PopoverMount.vue";
|
||||
import DropdownArrow from "../../../../assets/svg/16x24-bounds-8x16-icon/dropdown-arrow.svg";
|
||||
import VerticalEllipsis from "../../../../assets/svg/16x24-bounds-8x16-icon/vertical-ellipsis.svg";
|
||||
import Popover, { PopoverDirection } from "../overlays/Popover.vue";
|
||||
|
||||
export enum DropdownButtonIcon {
|
||||
export enum PopoverButtonIcon {
|
||||
"DropdownArrow" = "DropdownArrow",
|
||||
"VerticalEllipsis" = "VerticalEllipsis",
|
||||
}
|
||||
@@ -55,15 +55,15 @@ export default defineComponent({
|
||||
components: {
|
||||
VerticalEllipsis,
|
||||
DropdownArrow,
|
||||
PopoverMount,
|
||||
Popover,
|
||||
PopoverDirection,
|
||||
},
|
||||
props: {
|
||||
icon: { type: String, default: DropdownButtonIcon.DropdownArrow },
|
||||
icon: { type: String, default: PopoverButtonIcon.DropdownArrow },
|
||||
},
|
||||
methods: {
|
||||
clickButton() {
|
||||
(this.$refs.popover as typeof PopoverMount).setOpen();
|
||||
(this.$refs.popover as typeof Popover).setOpen();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<div class="menu-bar-input">
|
||||
<div class="entry"><GraphiteLogo width="16" height="16" /></div>
|
||||
<div class="entry"><span>File</span></div>
|
||||
<div class="entry"><span>Edit</span></div>
|
||||
<div class="entry"><span>Document</span></div>
|
||||
<div class="entry"><span>View</span></div>
|
||||
<div class="entry"><span>Help</span></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.menu-bar-input {
|
||||
display: flex;
|
||||
|
||||
.entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
padding: 0 8px;
|
||||
|
||||
svg {
|
||||
fill: #ddd;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #666;
|
||||
|
||||
svg {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { ApplicationPlatform } from "../../window/MainWindow.vue";
|
||||
import GraphiteLogo from "../../../../assets/svg/16x16-bounds-16x16-icon/graphite-logo.svg";
|
||||
|
||||
export default defineComponent({
|
||||
components: { GraphiteLogo },
|
||||
data() {
|
||||
return {
|
||||
ApplicationPlatform,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 0;
|
||||
line-height: 22px;
|
||||
line-height: 24px;
|
||||
color: #ddd;
|
||||
font-size: inherit;
|
||||
text-align: center;
|
||||
+20
-15
@@ -1,28 +1,37 @@
|
||||
<template>
|
||||
<div class="radio-picker" ref="radioPicker">
|
||||
<div class="radio-input" ref="radioInput">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.radio-picker {
|
||||
button,
|
||||
.dropdown-button {
|
||||
fill: #ddd;
|
||||
.radio-input {
|
||||
.popover-button button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
& > * {
|
||||
border-radius: 0;
|
||||
margin: 0;
|
||||
|
||||
&:first-child {
|
||||
&:first-child,
|
||||
&:first-child button {
|
||||
border-radius: 2px 0 0 2px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
&:last-child,
|
||||
&:last-child button {
|
||||
border-radius: 0 2px 2px 0;
|
||||
}
|
||||
|
||||
& + * {
|
||||
margin-left: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
button {
|
||||
background: #555;
|
||||
fill: #ddd;
|
||||
|
||||
&:hover {
|
||||
background: #666;
|
||||
@@ -32,10 +41,6 @@
|
||||
background: #3194d6;
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
& + .icon-button {
|
||||
margin-left: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -57,7 +62,7 @@ export default defineComponent({
|
||||
mounted() {
|
||||
this.updateActiveIconButton();
|
||||
|
||||
(this.$refs.radioPicker as Element).querySelectorAll(".icon-button").forEach((iconButton, index) => {
|
||||
(this.$refs.radioInput as Element).querySelectorAll(".icon-button").forEach((iconButton, index) => {
|
||||
iconButton.addEventListener("click", () => {
|
||||
this.activeIndex = index;
|
||||
this.$emit("changed", index);
|
||||
@@ -70,12 +75,12 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// This method may be called by the user of this component by setting a `ref="radioPicker"` attribute and calling `(this.$refs.viewModePicker as typeof RadioPicker).setActive(...)`
|
||||
// This method may be called by the user of this component by setting a `ref="radioInput"` attribute and calling `(this.$refs.viewModePicker as typeof RadioInput).setActive(...)`
|
||||
setActive(index: number) {
|
||||
this.activeIndex = index;
|
||||
},
|
||||
updateActiveIconButton() {
|
||||
const iconButtons = (this.$refs.radioPicker as Element).querySelectorAll(".icon-button");
|
||||
const iconButtons = (this.$refs.radioInput as Element).querySelectorAll(".icon-button");
|
||||
iconButtons.forEach((iconButton) => iconButton.classList.remove("active"));
|
||||
iconButtons[this.activeIndex].classList.add("active");
|
||||
},
|
||||
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<div class="swatch-pair">
|
||||
<div class="secondary swatch">
|
||||
<button @click="clickSecondarySwatch" style="background: white"></button>
|
||||
<Popover :direction="PopoverDirection.Right" horizontal ref="secondarySwatchPopover">
|
||||
<ColorPicker />
|
||||
</Popover>
|
||||
</div>
|
||||
<div class="primary swatch">
|
||||
<button @click="clickPrimarySwatch" style="background: black"></button>
|
||||
<Popover :direction="PopoverDirection.Right" horizontal ref="primarySwatchPopover">
|
||||
<ColorPicker />
|
||||
</Popover>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.swatch-pair {
|
||||
display: flex;
|
||||
// Reversed order of elements paired with `column-reverse` allows primary to overlap secondary without relying on `z-index`
|
||||
flex-direction: column-reverse;
|
||||
|
||||
.swatch {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin: 2px;
|
||||
position: relative;
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 2px #888 solid;
|
||||
box-shadow: 0 0 0 2px #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.popover {
|
||||
top: 50%;
|
||||
right: -2px;
|
||||
}
|
||||
|
||||
&.primary {
|
||||
margin-bottom: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import ColorPicker from "../../popovers/ColorPicker.vue";
|
||||
import Popover, { PopoverDirection } from "../overlays/Popover.vue";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
Popover,
|
||||
ColorPicker,
|
||||
},
|
||||
props: {},
|
||||
methods: {
|
||||
clickPrimarySwatch() {
|
||||
(this.$refs.primarySwatchPopover as typeof Popover).setOpen();
|
||||
(this.$refs.secondarySwatchPopover as typeof Popover).setClosed();
|
||||
},
|
||||
clickSecondarySwatch() {
|
||||
(this.$refs.secondarySwatchPopover as typeof Popover).setOpen();
|
||||
(this.$refs.primarySwatchPopover as typeof Popover).setClosed();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
PopoverDirection,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="icon-container" :class="[`size-${String(size)}`, gapAfter && 'gap-after']">
|
||||
<div class="icon" :class="[`size-${String(size)}`, gapAfter && 'gap-after']">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.icon-container {
|
||||
.icon {
|
||||
display: inline-block;
|
||||
flex: 0 0 auto;
|
||||
fill: #ddd;
|
||||
@@ -13,7 +13,7 @@
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
|
||||
&:not(.gap-after) + .icon-container {
|
||||
&:not(.gap-after) + .icon {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div class="user-input-label">
|
||||
<span class="input-key" v-for="inputKey in inputKeys" :key="inputKey" :class="keyCapWidth(inputKey)">
|
||||
{{ inputKey }}
|
||||
</span>
|
||||
<span class="input-mouse" v-if="inputMouse">
|
||||
<MouseHintNone v-if="inputMouse === MouseInputInteraction.None" width="16" height="16" />
|
||||
<MouseHintLMB v-if="inputMouse === MouseInputInteraction.LMB" width="16" height="16" />
|
||||
<MouseHintRMB v-if="inputMouse === MouseInputInteraction.RMB" width="16" height="16" />
|
||||
<MouseHintMMB v-if="inputMouse === MouseInputInteraction.MMB" width="16" height="16" />
|
||||
<MouseHintScrollUp v-if="inputMouse === MouseInputInteraction.ScrollUp" width="16" height="16" />
|
||||
<MouseHintScrollDown v-if="inputMouse === MouseInputInteraction.ScrollDown" width="16" height="16" />
|
||||
<MouseHintDrag v-if="inputMouse === MouseInputInteraction.Drag" width="16" height="16" />
|
||||
<MouseHintLMBDrag v-if="inputMouse === MouseInputInteraction.LMBDrag" width="16" height="16" />
|
||||
<MouseHintRMBDrag v-if="inputMouse === MouseInputInteraction.RMBDrag" width="16" height="16" />
|
||||
<MouseHintMMBDrag v-if="inputMouse === MouseInputInteraction.MMBDrag" width="16" height="16" />
|
||||
</span>
|
||||
<span class="hint-text">
|
||||
<slot></slot>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.user-input-label {
|
||||
height: 100%;
|
||||
margin: 0 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.input-key,
|
||||
.input-mouse {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.input-key {
|
||||
font-family: "Inconsolata", monospace;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
color: #111;
|
||||
background: #ddd;
|
||||
border: 1px;
|
||||
box-sizing: border-box;
|
||||
border-style: solid;
|
||||
border-color: #888;
|
||||
border-radius: 4px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.input-key.width-16 {
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.input-key.width-24 {
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.input-key.width-32 {
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.input-key.width-40 {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.input-key.width-48 {
|
||||
width: 48px;
|
||||
}
|
||||
|
||||
.input-mouse {
|
||||
.bright {
|
||||
fill: #ddd;
|
||||
}
|
||||
|
||||
.dim {
|
||||
fill: #888;
|
||||
}
|
||||
|
||||
svg {
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import MouseHintNone from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-none.svg";
|
||||
import MouseHintLMB from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-lmb.svg";
|
||||
import MouseHintRMB from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-rmb.svg";
|
||||
import MouseHintMMB from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-mmb.svg";
|
||||
import MouseHintScrollUp from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-scroll-up.svg";
|
||||
import MouseHintScrollDown from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-scroll-down.svg";
|
||||
import MouseHintDrag from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-drag.svg";
|
||||
import MouseHintLMBDrag from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-lmb-drag.svg";
|
||||
import MouseHintRMBDrag from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-rmb-drag.svg";
|
||||
import MouseHintMMBDrag from "../../../../assets/svg/16x16-bounds-16x16-icon/mouse-hint-mmb-drag.svg";
|
||||
|
||||
export enum MouseInputInteraction {
|
||||
"None" = "None",
|
||||
"LMB" = "LMB",
|
||||
"RMB" = "RMB",
|
||||
"MMB" = "MMB",
|
||||
"ScrollUp" = "ScrollUp",
|
||||
"ScrollDown" = "ScrollDown",
|
||||
"Drag" = "Drag",
|
||||
"LMBDrag" = "LMBDrag",
|
||||
"RMBDrag" = "RMBDrag",
|
||||
"MMBDrag" = "MMBDrag",
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MouseHintNone,
|
||||
MouseHintLMB,
|
||||
MouseHintRMB,
|
||||
MouseHintMMB,
|
||||
MouseHintScrollUp,
|
||||
MouseHintScrollDown,
|
||||
MouseHintDrag,
|
||||
MouseHintLMBDrag,
|
||||
MouseHintRMBDrag,
|
||||
MouseHintMMBDrag,
|
||||
},
|
||||
props: {
|
||||
inputKeys: { type: Array, default: () => [] },
|
||||
inputMouse: { type: String },
|
||||
},
|
||||
methods: {
|
||||
keyCapWidth(keyText: string) {
|
||||
return `width-${keyText.length * 8 + 8}`;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
MouseInputInteraction,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="popover-mount" :class="direction.toLowerCase()" v-if="open">
|
||||
<div class="popover" :class="direction.toLowerCase()" v-if="open">
|
||||
<div class="tail"></div>
|
||||
<div class="popover" ref="popover">
|
||||
<div class="popover-container" ref="popoverContainer">
|
||||
<div class="popover-content" ref="popoverContent">
|
||||
<slot></slot>
|
||||
</div>
|
||||
@@ -10,7 +10,7 @@
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.popover-mount {
|
||||
.popover {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.popover {
|
||||
.popover-container {
|
||||
display: flex;
|
||||
|
||||
.top > & {
|
||||
@@ -124,8 +124,8 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
updated() {
|
||||
const popoverContainer = this.$refs.popoverContainer as HTMLElement;
|
||||
const popoverContent = this.$refs.popoverContent as HTMLElement;
|
||||
const popover = this.$refs.popover as HTMLElement;
|
||||
const workspace = document.querySelector(".workspace");
|
||||
|
||||
if (popoverContent && workspace) {
|
||||
@@ -134,18 +134,18 @@ export default defineComponent({
|
||||
|
||||
if (this.direction === PopoverDirection.Left || this.direction === PopoverDirection.Right) {
|
||||
const topOffset = popoverBounds.top - workspaceBounds.top - 8;
|
||||
if (topOffset < 0) popover.style.transform = `translate(0, ${-topOffset}px)`;
|
||||
if (topOffset < 0) popoverContainer.style.transform = `translate(0, ${-topOffset}px)`;
|
||||
|
||||
const bottomOffset = workspaceBounds.bottom - popoverBounds.bottom - 8;
|
||||
if (bottomOffset < 0) popover.style.transform = `translate(0, ${bottomOffset}px)`;
|
||||
if (bottomOffset < 0) popoverContainer.style.transform = `translate(0, ${bottomOffset}px)`;
|
||||
}
|
||||
|
||||
if (this.direction === PopoverDirection.Top || this.direction === PopoverDirection.Bottom) {
|
||||
const leftOffset = popoverBounds.left - workspaceBounds.left - 8;
|
||||
if (leftOffset < 0) popover.style.transform = `translate(${-leftOffset}px, 0)`;
|
||||
if (leftOffset < 0) popoverContainer.style.transform = `translate(${-leftOffset}px, 0)`;
|
||||
|
||||
const rightOffset = workspaceBounds.right - popoverBounds.right - 8;
|
||||
if (rightOffset < 0) popover.style.transform = `translate(${rightOffset}px, 0)`;
|
||||
if (rightOffset < 0) popoverContainer.style.transform = `translate(${rightOffset}px, 0)`;
|
||||
}
|
||||
}
|
||||
},
|
||||
Reference in New Issue
Block a user