|
26 | 26 | class="w-auto cursor-pointer p-2"
|
27 | 27 | v-for="breakpoint in canvasProps.breakpoints"
|
28 | 28 | :key="breakpoint.device"
|
29 |
| - @click.stop="breakpoint.visible = !breakpoint.visible"> |
| 29 | + @click.stop="(ev) => selectBreakpoint(ev, breakpoint)"> |
30 | 30 | <FeatherIcon
|
31 | 31 | :name="breakpoint.icon"
|
32 | 32 | class="h-8 w-6"
|
|
46 | 46 | v-for="breakpoint in visibleBreakpoints"
|
47 | 47 | :key="breakpoint.device">
|
48 | 48 | <div
|
49 |
| - class="cursor absolute left-0 select-none text-3xl text-gray-700 dark:text-zinc-300" |
| 49 | + class="absolute left-0 cursor-pointer select-none text-3xl text-gray-700 dark:text-zinc-300" |
50 | 50 | :style="{
|
51 | 51 | fontSize: `calc(${12}px * 1/${canvasProps.scale})`,
|
52 | 52 | top: `calc(${-20}px * 1/${canvasProps.scale})`,
|
|
78 | 78 | import LoadingIcon from "@/components/Icons/Loading.vue";
|
79 | 79 | import { BreakpointConfig, CanvasHistory } from "@/types/Builder/BuilderCanvas";
|
80 | 80 | import Block from "@/utils/block";
|
81 |
| -import { getBlockCopy } from "@/utils/helpers"; |
| 81 | +import { getBlockCopy, isCtrlOrCmd } from "@/utils/helpers"; |
82 | 82 | import { useBlockEventHandlers } from "@/utils/useBlockEventHandlers";
|
83 | 83 | import { useBlockSelection } from "@/utils/useBlockSelection";
|
84 | 84 | import { useCanvasDropZone } from "@/utils/useCanvasDropZone";
|
@@ -182,9 +182,7 @@ const { isOverDropZone } = useCanvasDropZone(
|
182 | 182 | );
|
183 | 183 |
|
184 | 184 | const visibleBreakpoints = computed(() => {
|
185 |
| - return canvasProps.breakpoints.filter( |
186 |
| - (breakpoint) => breakpoint.visible || breakpoint.device === "desktop", |
187 |
| - ); |
| 185 | + return canvasProps.breakpoints.filter((breakpoint) => breakpoint.visible); |
188 | 186 | });
|
189 | 187 |
|
190 | 188 | onMounted(() => {
|
@@ -270,4 +268,17 @@ defineExpose({
|
270 | 268 | removeBlock,
|
271 | 269 | selectBlockRange,
|
272 | 270 | });
|
| 271 | +
|
| 272 | +function selectBreakpoint(ev: MouseEvent, breakpoint: BreakpointConfig) { |
| 273 | + if (isCtrlOrCmd(ev)) { |
| 274 | + canvasProps.breakpoints.forEach((bp) => { |
| 275 | + bp.visible = bp.device === breakpoint.device; |
| 276 | + }); |
| 277 | + } else { |
| 278 | + breakpoint.visible = !breakpoint.visible; |
| 279 | + if (canvasProps.breakpoints.filter((bp) => bp.visible).length === 0) { |
| 280 | + breakpoint.visible = true; |
| 281 | + } |
| 282 | + } |
| 283 | +} |
273 | 284 | </script>
|
0 commit comments