@blokkli/editor 2.0.0-alpha.22 → 2.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +150 -226
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +20 -14
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +8 -4
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +55 -25
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +5 -4
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +9 -2
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +2 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +1 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +3 -1
- package/dist/runtime/blokkliPlugins/index.d.ts +1 -5
- package/dist/runtime/blokkliPlugins/index.js +0 -8
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +0 -5
- package/dist/runtime/components/BlokkliEditable.vue +6 -1
- package/dist/runtime/components/BlokkliField.vue +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +4 -4
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +66 -0
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Actions/index.vue +80 -117
- package/dist/runtime/components/Edit/AddListItem/index.vue +8 -29
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +2 -3
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +23 -68
- package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
- package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
- package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
- package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -8
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +33 -49
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +14 -1
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +93 -0
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +26 -5
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/DraggableList.vue +5 -25
- package/dist/runtime/components/Edit/EditProvider.vue +71 -41
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +52 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
- package/dist/runtime/components/Edit/Features/{Selection/OverlayFallback → AddList/Actions}/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/{BlockAddList → AddList/Blocks}/index.vue +36 -108
- package/dist/runtime/components/Edit/Features/{Hover/Overlay → AddList/Blocks}/index.vue.d.ts +7 -2
- package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -110
- package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue → Main.vue} +4 -8
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/fragment.glsl +10 -6
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue +43 -15
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/vertex.glsl +11 -9
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -3
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +7 -3
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +41 -20
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +22 -11
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +70 -29
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
- package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +16 -9
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue +24 -0
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/Debug/Main.vue +80 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Features.vue +34 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue +15 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue +17 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue +66 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue +96 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue +25 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +23 -119
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +77 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue +138 -92
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/vertex.glsl +60 -8
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +4 -5
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +0 -6
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +8 -4
- package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
- package/dist/runtime/components/Edit/Features/Hover/Renderer/fragment.glsl +141 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/index.vue +225 -38
- package/dist/runtime/components/Edit/Features/Hover/Renderer/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/vertex.glsl +49 -11
- package/dist/runtime/components/Edit/Features/Hover/index.vue +9 -6
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +50 -36
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +26 -13
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +3 -47
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl +13 -26
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue +131 -75
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/vertex.glsl +27 -2
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +25 -12
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +23 -6
- package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +21 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +19 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +242 -131
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +29 -12
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +15 -10
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/fragment.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue +121 -28
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/vertex.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/index.vue +46 -59
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +25 -17
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Transform/index.vue +30 -23
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue +43 -0
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
- package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
- package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
- package/dist/runtime/components/Edit/Konami/index.vue +3 -5
- package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
- package/dist/runtime/components/Edit/Messages/Item/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Messages/index.vue +6 -1
- package/dist/runtime/components/Edit/Overlay/index.vue +66 -0
- package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +1 -1
- package/dist/runtime/components/Edit/Sortli/index.vue +5 -8
- package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
- package/dist/runtime/components/Edit/Toolbar/index.vue +47 -51
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +9 -2
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +4 -1
- package/dist/runtime/components/Edit/index.d.ts +7 -5
- package/dist/runtime/components/Edit/index.js +13 -9
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +58 -9
- package/dist/runtime/helpers/animationProvider.js +318 -75
- package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.js +10 -0
- package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +5 -2
- package/dist/runtime/helpers/composables/defineRenderer.js +3 -2
- package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
- package/dist/runtime/helpers/composables/useDialog.js +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.js +36 -0
- package/dist/runtime/helpers/debugProvider.d.ts +13 -3
- package/dist/runtime/helpers/debugProvider.js +80 -12
- package/dist/runtime/helpers/defineElementStyle.d.ts +2 -0
- package/dist/runtime/helpers/defineElementStyle.js +33 -0
- package/dist/runtime/helpers/domProvider.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.js +51 -32
- package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
- package/dist/runtime/helpers/dropTargets/index.js +18 -4
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -6
- package/dist/runtime/helpers/index.js +0 -81
- package/dist/runtime/helpers/pluginProvider.d.ts +38 -3
- package/dist/runtime/helpers/pluginProvider.js +49 -18
- package/dist/runtime/helpers/providers/blocks.js +10 -0
- package/dist/runtime/helpers/providers/directive.d.ts +4 -1
- package/dist/runtime/helpers/providers/directive.js +9 -2
- package/dist/runtime/helpers/providers/fields.d.ts +9 -1
- package/dist/runtime/helpers/stateProvider.js +1 -0
- package/dist/runtime/helpers/uiProvider.d.ts +13 -12
- package/dist/runtime/helpers/uiProvider.js +117 -81
- package/dist/runtime/helpers/webgl/index.d.ts +2 -3
- package/dist/runtime/helpers/webgl/index.js +9 -14
- package/dist/runtime/icons/click.svg +1 -0
- package/dist/runtime/icons/dock-left.svg +1 -0
- package/dist/runtime/icons/dock-right.svg +1 -0
- package/dist/runtime/icons/dock-window.svg +1 -0
- package/dist/runtime/plugins/blokkliDirectives.js +1 -1
- package/dist/runtime/types/index.d.ts +16 -26
- package/package.json +1 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +0 -56
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +0 -24
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +0 -76
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +0 -31
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -66
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
- package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +0 -15
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +0 -240
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +0 -96
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +0 -139
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +0 -42
- /package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/Anchors/{Renderer.vue → Overlay/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/{BlockAddList → Anchors/Overlay}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Debug/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/{Anchors/Renderer.vue.d.ts → Debug/Section/Features.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue → Banner/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue.d.ts → Banner/index.vue.d.ts} +0 -0
|
@@ -12,34 +12,36 @@
|
|
|
12
12
|
class="bk-selection-add-overlay-list bk-scrollbar-dark"
|
|
13
13
|
@wheel="onWheel"
|
|
14
14
|
>
|
|
15
|
-
<
|
|
15
|
+
<AddListItem
|
|
16
16
|
v-for="item in items"
|
|
17
|
+
:id="item.bundle"
|
|
17
18
|
:key="item.bundle"
|
|
19
|
+
context="selection-add-buttons"
|
|
20
|
+
:label="item.label"
|
|
21
|
+
:bundle="item.bundle"
|
|
22
|
+
:color="item.isFavorite ? 'yellow' : void 0"
|
|
18
23
|
tabindex="-1"
|
|
19
24
|
@click.prevent="$emit('select', item.bundle)"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
:bundle="item.bundle"
|
|
23
|
-
:color="item.isFavorite ? 'yellow' : 'default'"
|
|
24
|
-
/>
|
|
25
|
-
<span>{{ item.label }}</span>
|
|
26
|
-
</button>
|
|
27
|
-
<button
|
|
25
|
+
/>
|
|
26
|
+
<AddListItem
|
|
28
27
|
v-for="action in actions"
|
|
28
|
+
:id="action.id"
|
|
29
29
|
:key="'action:' + action.id"
|
|
30
30
|
tabindex="-1"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
context="selection-add-buttons"
|
|
32
|
+
:icon="action.icon"
|
|
33
|
+
:label="action.title"
|
|
34
|
+
:color="action.color"
|
|
35
|
+
no-context-menu
|
|
36
|
+
@click.prevent="$emit('action', action)"
|
|
37
|
+
/>
|
|
36
38
|
</div>
|
|
37
39
|
</ArtboardTooltip>
|
|
38
40
|
</template>
|
|
39
41
|
|
|
40
42
|
<script setup>
|
|
41
43
|
import { useTemplateRef, useBlokkli, computed } from "#imports";
|
|
42
|
-
import {
|
|
44
|
+
import { ArtboardTooltip, AddListItem } from "#blokkli/components";
|
|
43
45
|
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
44
46
|
const props = defineProps({
|
|
45
47
|
bundles: { type: Array, required: true },
|
|
@@ -66,7 +68,7 @@ const items = computed(() => {
|
|
|
66
68
|
});
|
|
67
69
|
});
|
|
68
70
|
const actions = computed(() => {
|
|
69
|
-
return plugins.
|
|
71
|
+
return plugins.get("addAction").filter((action) => {
|
|
70
72
|
if (!action.itemBundle) {
|
|
71
73
|
return true;
|
|
72
74
|
}
|
|
@@ -79,7 +81,9 @@ const onWheel = (e) => {
|
|
|
79
81
|
hasScrollbar = element && element.scrollHeight > element.clientHeight;
|
|
80
82
|
}
|
|
81
83
|
if (hasScrollbar) {
|
|
82
|
-
e.
|
|
84
|
+
if (!e.ctrlKey && !e.metaKey) {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
}
|
|
83
87
|
}
|
|
84
88
|
};
|
|
85
89
|
</script>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { Coord } from '#blokkli/types';
|
|
1
|
+
import type { AddAction, Coord } from '#blokkli/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
bundles: string[];
|
|
4
4
|
anchorEl?: HTMLElement;
|
|
5
5
|
anchorCoordinates?: Coord;
|
|
6
6
|
label: string;
|
|
7
7
|
};
|
|
8
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
|
+
select: (id: string) => any;
|
|
10
|
+
close: () => any;
|
|
11
|
+
action: (action: AddAction) => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
-
onAction?: ((id: string) => any) | undefined;
|
|
14
13
|
onSelect?: ((id: string) => any) | undefined;
|
|
15
14
|
onClose?: (() => any) | undefined;
|
|
15
|
+
onAction?: ((action: AddAction) => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
export default _default;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
#version 300 es
|
|
2
|
+
|
|
1
3
|
precision highp float;
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
in vec4 v_quad;
|
|
6
|
+
in vec2 v_circle_center;
|
|
7
|
+
in float v_visible;
|
|
8
|
+
in float v_is_hovered;
|
|
9
|
+
in float v_scale_fade;
|
|
10
|
+
in float v_rect_id;
|
|
11
|
+
in float v_radius;
|
|
12
|
+
in float v_inner_radius;
|
|
13
|
+
in float v_scale_factor;
|
|
14
|
+
|
|
15
|
+
out vec4 fragColor;
|
|
9
16
|
|
|
10
17
|
uniform float u_dpi;
|
|
11
18
|
uniform vec3 u_color;
|
|
@@ -23,14 +30,9 @@ void main() {
|
|
|
23
30
|
vec2 pixelPos = gl_FragCoord.xy;
|
|
24
31
|
float dist = distance(pixelPos, v_circle_center);
|
|
25
32
|
|
|
26
|
-
// Circle
|
|
27
|
-
float radius =
|
|
28
|
-
|
|
29
|
-
// Border width in pixels (must match vertex shader) - scaled by DPI
|
|
30
|
-
float borderWidth = 4.0 * u_dpi;
|
|
31
|
-
|
|
32
|
-
// Inner circle radius (without border)
|
|
33
|
-
float innerRadius = radius - borderWidth;
|
|
33
|
+
// Circle radii passed from vertex shader (in viewport pixels)
|
|
34
|
+
float radius = v_radius;
|
|
35
|
+
float innerRadius = v_inner_radius;
|
|
34
36
|
|
|
35
37
|
// Anti-aliased circle
|
|
36
38
|
float edgeSoftness = 1.0 * u_dpi;
|
|
@@ -46,9 +48,9 @@ void main() {
|
|
|
46
48
|
// Plus dimensions relative to inner circle radius
|
|
47
49
|
// Reduce thickness at low DPI (zoomed out)
|
|
48
50
|
float plusThicknessBase = u_dpi <= 0.5 ? 1.25 : 1.5;
|
|
49
|
-
float plusThickness = plusThicknessBase * u_dpi;
|
|
51
|
+
float plusThickness = plusThicknessBase * u_dpi * v_scale_factor;
|
|
50
52
|
float plusLength = innerRadius * 0.5; // 50% of inner radius
|
|
51
|
-
float plusSoftness = 0.25 * u_dpi;
|
|
53
|
+
float plusSoftness = 0.25 * u_dpi * v_scale_factor;
|
|
52
54
|
|
|
53
55
|
// Calculate soft plus factor (0 = not plus, 1 = fully plus)
|
|
54
56
|
float horizontalDist = max(abs(offset.y) - plusThickness, 0.0);
|
|
@@ -102,5 +104,5 @@ void main() {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
// Apply scale fade to alpha
|
|
105
|
-
|
|
107
|
+
fragColor = vec4(finalColor, alpha);
|
|
106
108
|
}
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
21
21
|
import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
|
|
22
22
|
import { useBlokkli, computed, ref } from "#imports";
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
setBuffersAndAttributes,
|
|
25
|
+
drawBufferInfo,
|
|
26
|
+
setUniforms
|
|
27
|
+
} from "twgl.js";
|
|
24
28
|
import vs from "./vertex.glsl?raw";
|
|
25
29
|
import fs from "./fragment.glsl?raw";
|
|
26
30
|
import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
|
|
@@ -113,44 +117,26 @@ const tooltipData = computed(() => {
|
|
|
113
117
|
return { x: screenX, y: screenY, transform, position, text, isField };
|
|
114
118
|
});
|
|
115
119
|
const emit = defineEmits(["toggle", "toggleField"]);
|
|
116
|
-
const gl = animation.gl();
|
|
117
|
-
const programInfo = gl ? animation.registerProgram("add-buttons", gl, [vs, fs]) : null;
|
|
118
120
|
const MAX_CIRCLES = 10;
|
|
119
121
|
const BUTTON_RADIUS = 12;
|
|
120
122
|
const TOOLTIP_MARGIN = 20;
|
|
121
|
-
|
|
122
|
-
if (gl) {
|
|
123
|
-
class CircleBufferCollector extends RectangleBufferCollector {
|
|
124
|
-
}
|
|
125
|
-
const collector = new CircleBufferCollector(gl);
|
|
126
|
-
for (let i = 0; i < MAX_CIRCLES; i++) {
|
|
127
|
-
collector.addRectangle(
|
|
128
|
-
{
|
|
129
|
-
id: `circle-${i}`,
|
|
130
|
-
x: 0,
|
|
131
|
-
y: 0,
|
|
132
|
-
width: 40,
|
|
133
|
-
height: 40
|
|
134
|
-
},
|
|
135
|
-
i
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
bufferInfo = collector.createBufferInfo();
|
|
123
|
+
class CircleBufferCollector extends RectangleBufferCollector {
|
|
139
124
|
}
|
|
125
|
+
let bufferInfoCache = null;
|
|
140
126
|
const circlePositions = new Float32Array(MAX_CIRCLES * 2);
|
|
141
127
|
const circleVisible = new Float32Array(MAX_CIRCLES);
|
|
142
128
|
const hoveredCircle = ref(-1);
|
|
143
129
|
const color = computed(() => {
|
|
144
|
-
return
|
|
130
|
+
return theme.accent.value[600];
|
|
145
131
|
});
|
|
146
132
|
const colorHover = computed(() => {
|
|
147
|
-
return
|
|
133
|
+
return theme.accent.value[500];
|
|
148
134
|
});
|
|
149
135
|
const colorField = computed(() => {
|
|
150
|
-
return
|
|
136
|
+
return theme.accent.value[400];
|
|
151
137
|
});
|
|
152
138
|
const colorFieldHover = computed(() => {
|
|
153
|
-
return
|
|
139
|
+
return theme.accent.value[300];
|
|
154
140
|
});
|
|
155
141
|
const orientationCache = /* @__PURE__ */ new Map();
|
|
156
142
|
const currentOrientation = ref("horizontal");
|
|
@@ -310,127 +296,252 @@ function getCircleAtPoint(x, y) {
|
|
|
310
296
|
}
|
|
311
297
|
return -1;
|
|
312
298
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
299
|
+
const { collector } = defineRenderer("add-buttons", {
|
|
300
|
+
zIndex: 1e3,
|
|
301
|
+
collector: () => {
|
|
302
|
+
const c = new CircleBufferCollector();
|
|
303
|
+
for (let i = 0; i < MAX_CIRCLES; i++) {
|
|
304
|
+
c.addRectangle(
|
|
305
|
+
{
|
|
306
|
+
id: `circle-${i}`,
|
|
307
|
+
x: 0,
|
|
308
|
+
y: 0,
|
|
309
|
+
width: 40,
|
|
310
|
+
height: 40
|
|
311
|
+
},
|
|
312
|
+
i
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
return c;
|
|
316
|
+
},
|
|
317
|
+
program: () => ({ shaders: [vs, fs] }),
|
|
318
|
+
enabled: () => {
|
|
319
|
+
if (selection.uuids.value.length !== 1) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
if (ui.openTooltip.value && ui.openTooltip.value !== "add-buttons") {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
if (ui.hasTransformOverlayOpen.value) {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
return true;
|
|
329
|
+
},
|
|
330
|
+
cursor: () => hoveredCircle.value >= 0 ? "pointer" : null,
|
|
331
|
+
onClick: ({ mouseArtboard }) => {
|
|
332
|
+
if (selection.uuids.value.length !== 1) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
const clickedCircle = getCircleAtPoint(mouseArtboard.x, mouseArtboard.y);
|
|
336
|
+
if (clickedCircle >= 0) {
|
|
337
|
+
const cx = circlePositions[clickedCircle * 2];
|
|
338
|
+
const cy = circlePositions[clickedCircle * 2 + 1];
|
|
339
|
+
if (clickedCircle === 0 || clickedCircle === 1) {
|
|
340
|
+
const position = clickedCircle === 0 ? "before" : "after";
|
|
341
|
+
emit("toggle", {
|
|
342
|
+
position,
|
|
343
|
+
coordinates: { x: cx, y: cy }
|
|
344
|
+
});
|
|
345
|
+
} else {
|
|
346
|
+
const fieldIndex = clickedCircle - 2;
|
|
347
|
+
emit("toggleField", {
|
|
348
|
+
index: fieldIndex,
|
|
349
|
+
coordinates: { x: cx, y: cy }
|
|
350
|
+
});
|
|
325
351
|
}
|
|
326
352
|
return true;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
},
|
|
356
|
+
render: (ctx, gl, program) => {
|
|
357
|
+
if (!bufferInfoCache) {
|
|
358
|
+
bufferInfoCache = collector.createBufferInfo(gl);
|
|
359
|
+
}
|
|
360
|
+
if (!bufferInfoCache) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
circleVisible.fill(0);
|
|
364
|
+
if (ctx.selectedUuids.length !== 1) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const uuid = ctx.selectedUuids[0];
|
|
368
|
+
if (!uuid) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const blockState = getBlockState(uuid);
|
|
372
|
+
if (blockState.canShowBeforeAfter) {
|
|
373
|
+
const blockRect = dom.getBlockRect(uuid);
|
|
374
|
+
if (!blockRect || blockRect.width === 0) {
|
|
375
|
+
return;
|
|
332
376
|
}
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return true;
|
|
377
|
+
const orientation = getOrientationForUuid(uuid);
|
|
378
|
+
currentOrientation.value = orientation;
|
|
379
|
+
const BUTTON_SHIFT = 2 / ctx.artboardScale;
|
|
380
|
+
if (orientation === "horizontal") {
|
|
381
|
+
circlePositions[0] = blockRect.x - BUTTON_SHIFT;
|
|
382
|
+
circlePositions[1] = blockRect.y + blockRect.height / 2;
|
|
383
|
+
circleVisible[0] = 1;
|
|
384
|
+
circlePositions[2] = blockRect.x + blockRect.width + BUTTON_SHIFT;
|
|
385
|
+
circlePositions[3] = blockRect.y + blockRect.height / 2;
|
|
386
|
+
circleVisible[1] = 1;
|
|
387
|
+
} else {
|
|
388
|
+
circlePositions[0] = blockRect.x + blockRect.width / 2;
|
|
389
|
+
circlePositions[1] = blockRect.y - BUTTON_SHIFT;
|
|
390
|
+
circleVisible[0] = 1;
|
|
391
|
+
circlePositions[2] = blockRect.x + blockRect.width / 2;
|
|
392
|
+
circlePositions[3] = blockRect.y + blockRect.height + BUTTON_SHIFT;
|
|
393
|
+
circleVisible[1] = 1;
|
|
351
394
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
395
|
+
}
|
|
396
|
+
currentUuid.value = uuid;
|
|
397
|
+
currentBundleLabel.value = blockState.bundleLabel;
|
|
398
|
+
currentSingleAllowedBundleLabel.value = blockState.singleAllowedBundleLabel;
|
|
399
|
+
if (blockState.emptyFieldKeys.length > 0) {
|
|
400
|
+
emptyFieldTooltips.value = blockState.emptyFieldTooltips;
|
|
401
|
+
for (let i = 0; i < blockState.emptyFieldKeys.length && i < 8; i++) {
|
|
402
|
+
const fieldKey = blockState.emptyFieldKeys[i];
|
|
403
|
+
if (!fieldKey) {
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
const fieldRect = dom.getFieldRect(fieldKey);
|
|
407
|
+
if (!fieldRect) {
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
const circleIndex = i + 2;
|
|
411
|
+
circlePositions[circleIndex * 2] = fieldRect.x + fieldRect.width / 2;
|
|
412
|
+
circlePositions[circleIndex * 2 + 1] = fieldRect.y + fieldRect.height / 2;
|
|
413
|
+
circleVisible[circleIndex] = 1;
|
|
357
414
|
}
|
|
358
|
-
|
|
359
|
-
|
|
415
|
+
} else {
|
|
416
|
+
emptyFieldTooltips.value = [];
|
|
417
|
+
}
|
|
418
|
+
hoveredCircle.value = getCircleAtPoint(
|
|
419
|
+
ctx.mouseArtboard.x,
|
|
420
|
+
ctx.mouseArtboard.y
|
|
421
|
+
);
|
|
422
|
+
gl.useProgram(program.program);
|
|
423
|
+
setUniforms(program, {
|
|
424
|
+
u_circle_positions: circlePositions,
|
|
425
|
+
u_circle_visible: circleVisible,
|
|
426
|
+
u_color: toShaderColor(color.value),
|
|
427
|
+
u_color_hover: toShaderColor(colorHover.value),
|
|
428
|
+
u_color_field: toShaderColor(colorField.value),
|
|
429
|
+
u_color_field_hover: toShaderColor(colorFieldHover.value),
|
|
430
|
+
u_hovered_circle: hoveredCircle.value,
|
|
431
|
+
u_radius: BUTTON_RADIUS,
|
|
432
|
+
u_scale_transition: ctx.changeOptionsTransition
|
|
433
|
+
});
|
|
434
|
+
animation.setSharedUniforms(gl, program);
|
|
435
|
+
setBuffersAndAttributes(gl, program, bufferInfoCache);
|
|
436
|
+
drawBufferInfo(gl, bufferInfoCache, gl.TRIANGLES);
|
|
437
|
+
},
|
|
438
|
+
renderFallback: (ctx, ctx2d) => {
|
|
439
|
+
circleVisible.fill(0);
|
|
440
|
+
if (ctx.selectedUuids.length !== 1) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const uuid = ctx.selectedUuids[0];
|
|
444
|
+
if (!uuid) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const blockState = getBlockState(uuid);
|
|
448
|
+
if (blockState.canShowBeforeAfter) {
|
|
449
|
+
const blockRect = dom.getBlockRect(uuid);
|
|
450
|
+
if (!blockRect || blockRect.width === 0) {
|
|
360
451
|
return;
|
|
361
452
|
}
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
453
|
+
const orientation = getOrientationForUuid(uuid);
|
|
454
|
+
currentOrientation.value = orientation;
|
|
455
|
+
const BUTTON_SHIFT = 2 / ctx.artboardScale;
|
|
456
|
+
if (orientation === "horizontal") {
|
|
457
|
+
circlePositions[0] = blockRect.x - BUTTON_SHIFT;
|
|
458
|
+
circlePositions[1] = blockRect.y + blockRect.height / 2;
|
|
459
|
+
circleVisible[0] = 1;
|
|
460
|
+
circlePositions[2] = blockRect.x + blockRect.width + BUTTON_SHIFT;
|
|
461
|
+
circlePositions[3] = blockRect.y + blockRect.height / 2;
|
|
462
|
+
circleVisible[1] = 1;
|
|
463
|
+
} else {
|
|
464
|
+
circlePositions[0] = blockRect.x + blockRect.width / 2;
|
|
465
|
+
circlePositions[1] = blockRect.y - BUTTON_SHIFT;
|
|
466
|
+
circleVisible[0] = 1;
|
|
467
|
+
circlePositions[2] = blockRect.x + blockRect.width / 2;
|
|
468
|
+
circlePositions[3] = blockRect.y + blockRect.height + BUTTON_SHIFT;
|
|
469
|
+
circleVisible[1] = 1;
|
|
365
470
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
471
|
+
}
|
|
472
|
+
currentUuid.value = uuid;
|
|
473
|
+
currentBundleLabel.value = blockState.bundleLabel;
|
|
474
|
+
currentSingleAllowedBundleLabel.value = blockState.singleAllowedBundleLabel;
|
|
475
|
+
if (blockState.emptyFieldKeys.length > 0) {
|
|
476
|
+
emptyFieldTooltips.value = blockState.emptyFieldTooltips;
|
|
477
|
+
for (let i = 0; i < blockState.emptyFieldKeys.length && i < 8; i++) {
|
|
478
|
+
const fieldKey = blockState.emptyFieldKeys[i];
|
|
479
|
+
if (!fieldKey) {
|
|
480
|
+
continue;
|
|
371
481
|
}
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (orientation === "horizontal") {
|
|
376
|
-
circlePositions[0] = blockRect.x - BUTTON_SHIFT;
|
|
377
|
-
circlePositions[1] = blockRect.y + blockRect.height / 2;
|
|
378
|
-
circleVisible[0] = 1;
|
|
379
|
-
circlePositions[2] = blockRect.x + blockRect.width + BUTTON_SHIFT;
|
|
380
|
-
circlePositions[3] = blockRect.y + blockRect.height / 2;
|
|
381
|
-
circleVisible[1] = 1;
|
|
382
|
-
} else {
|
|
383
|
-
circlePositions[0] = blockRect.x + blockRect.width / 2;
|
|
384
|
-
circlePositions[1] = blockRect.y - BUTTON_SHIFT;
|
|
385
|
-
circleVisible[0] = 1;
|
|
386
|
-
circlePositions[2] = blockRect.x + blockRect.width / 2;
|
|
387
|
-
circlePositions[3] = blockRect.y + blockRect.height + BUTTON_SHIFT;
|
|
388
|
-
circleVisible[1] = 1;
|
|
482
|
+
const fieldRect = dom.getFieldRect(fieldKey);
|
|
483
|
+
if (!fieldRect) {
|
|
484
|
+
continue;
|
|
389
485
|
}
|
|
486
|
+
const circleIndex = i + 2;
|
|
487
|
+
circlePositions[circleIndex * 2] = fieldRect.x + fieldRect.width / 2;
|
|
488
|
+
circlePositions[circleIndex * 2 + 1] = fieldRect.y + fieldRect.height / 2;
|
|
489
|
+
circleVisible[circleIndex] = 1;
|
|
390
490
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
491
|
+
} else {
|
|
492
|
+
emptyFieldTooltips.value = [];
|
|
493
|
+
}
|
|
494
|
+
hoveredCircle.value = getCircleAtPoint(
|
|
495
|
+
ctx.mouseArtboard.x,
|
|
496
|
+
ctx.mouseArtboard.y
|
|
497
|
+
);
|
|
498
|
+
const rgbToCss = (rgb) => {
|
|
499
|
+
return `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`;
|
|
500
|
+
};
|
|
501
|
+
const borderWidth = 2 * ctx.dpi;
|
|
502
|
+
const radius = BUTTON_RADIUS * ctx.dpi * ctx.changeOptionsTransition;
|
|
503
|
+
const innerRadius = radius - borderWidth;
|
|
504
|
+
for (let i = 0; i < MAX_CIRCLES; i++) {
|
|
505
|
+
if (circleVisible[i] <= 0) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
const artboardX = circlePositions[i * 2];
|
|
509
|
+
const artboardY = circlePositions[i * 2 + 1];
|
|
510
|
+
const viewportX = (artboardX * ctx.artboardScale + ctx.artboardOffset.x) * ctx.dpi;
|
|
511
|
+
const viewportY = (artboardY * ctx.artboardScale + ctx.artboardOffset.y) * ctx.dpi;
|
|
512
|
+
const isFieldButton = i >= 2;
|
|
513
|
+
const isHovered = hoveredCircle.value === i;
|
|
514
|
+
let fillColor;
|
|
515
|
+
if (isFieldButton) {
|
|
516
|
+
fillColor = isHovered ? colorFieldHover.value : colorField.value;
|
|
410
517
|
} else {
|
|
411
|
-
|
|
518
|
+
fillColor = isHovered ? colorHover.value : color.value;
|
|
412
519
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
520
|
+
ctx2d.fillStyle = rgbToCss(fillColor);
|
|
521
|
+
ctx2d.strokeStyle = "rgb(255, 255, 255)";
|
|
522
|
+
ctx2d.lineWidth = borderWidth;
|
|
523
|
+
ctx2d.beginPath();
|
|
524
|
+
ctx2d.arc(viewportX, viewportY, radius, 0, Math.PI * 2);
|
|
525
|
+
ctx2d.fill();
|
|
526
|
+
ctx2d.stroke();
|
|
527
|
+
const plusThickness = (ctx.dpi <= 0.5 ? 1.25 : 1.5) * ctx.dpi;
|
|
528
|
+
const plusLength = innerRadius * 0.5;
|
|
529
|
+
ctx2d.fillStyle = "rgb(255, 255, 255)";
|
|
530
|
+
ctx2d.fillRect(
|
|
531
|
+
viewportX - plusLength,
|
|
532
|
+
viewportY - plusThickness,
|
|
533
|
+
plusLength * 2,
|
|
534
|
+
plusThickness * 2
|
|
535
|
+
);
|
|
536
|
+
ctx2d.fillRect(
|
|
537
|
+
viewportX - plusThickness,
|
|
538
|
+
viewportY - plusLength,
|
|
539
|
+
plusThickness * 2,
|
|
540
|
+
plusLength * 2
|
|
416
541
|
);
|
|
417
|
-
gl.useProgram(programInfo.program);
|
|
418
|
-
setUniforms(programInfo, {
|
|
419
|
-
u_circle_positions: circlePositions,
|
|
420
|
-
u_circle_visible: circleVisible,
|
|
421
|
-
u_color: color.value,
|
|
422
|
-
u_color_hover: colorHover.value,
|
|
423
|
-
u_color_field: colorField.value,
|
|
424
|
-
u_color_field_hover: colorFieldHover.value,
|
|
425
|
-
u_hovered_circle: hoveredCircle.value,
|
|
426
|
-
u_radius: BUTTON_RADIUS
|
|
427
|
-
});
|
|
428
|
-
animation.setSharedUniforms(gl, programInfo);
|
|
429
|
-
setBuffersAndAttributes(gl, programInfo, bufferInfo);
|
|
430
|
-
drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
|
|
431
542
|
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
543
|
+
}
|
|
544
|
+
});
|
|
434
545
|
</script>
|
|
435
546
|
|
|
436
547
|
<script>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
#version 300 es
|
|
2
|
+
|
|
1
3
|
precision highp float;
|
|
2
4
|
|
|
3
5
|
// [x, y] position.
|
|
4
|
-
|
|
6
|
+
in vec2 a_position;
|
|
5
7
|
// The [x,y,width, height] of the quad the vertex belongs to.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
in vec4 a_quad;
|
|
9
|
+
in float a_rect_id;
|
|
8
10
|
|
|
9
11
|
// The global scaling applied to all quads.
|
|
10
12
|
uniform float u_scale;
|
|
@@ -14,6 +16,8 @@ uniform float u_offset_x;
|
|
|
14
16
|
// The amount of pixels to offset on the y axis.
|
|
15
17
|
uniform float u_offset_y;
|
|
16
18
|
uniform vec2 u_resolution;
|
|
19
|
+
// Scale transition for change options animation
|
|
20
|
+
uniform float u_scale_transition;
|
|
17
21
|
|
|
18
22
|
// Circle positions (10 vec2s = 20 floats)
|
|
19
23
|
uniform vec2 u_circle_positions[10];
|
|
@@ -25,12 +29,15 @@ uniform float u_hovered_circle;
|
|
|
25
29
|
uniform float u_radius;
|
|
26
30
|
|
|
27
31
|
// The transformed quad for the fragment shader.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
out vec4 v_quad;
|
|
33
|
+
out vec2 v_circle_center;
|
|
34
|
+
out float v_visible;
|
|
35
|
+
out float v_is_hovered;
|
|
36
|
+
out float v_scale_fade;
|
|
37
|
+
out float v_rect_id;
|
|
38
|
+
out float v_radius;
|
|
39
|
+
out float v_inner_radius;
|
|
40
|
+
out float v_scale_factor;
|
|
34
41
|
|
|
35
42
|
void main() {
|
|
36
43
|
int rectId = int(a_rect_id);
|
|
@@ -49,13 +56,23 @@ void main() {
|
|
|
49
56
|
v_scale_fade = clamp(v_scale_fade, 0.0, 1.0);
|
|
50
57
|
}
|
|
51
58
|
|
|
59
|
+
// Combined scale factor for fragment shader
|
|
60
|
+
v_scale_factor = v_scale_fade * u_scale_transition;
|
|
61
|
+
|
|
52
62
|
// Border width in pixels (must match fragment shader)
|
|
53
|
-
float borderWidth =
|
|
63
|
+
float borderWidth = 2.0;
|
|
54
64
|
|
|
55
65
|
// Circle radius in artboard space - apply inverse scaling to keep constant size
|
|
56
|
-
// Then multiply by fade factor
|
|
66
|
+
// Then multiply by fade factor and scale transition
|
|
57
67
|
// Add border width to the radius so the border renders outside
|
|
58
|
-
float radius =
|
|
68
|
+
float radius =
|
|
69
|
+
(u_radius + borderWidth) / u_scale * v_scale_fade * u_scale_transition;
|
|
70
|
+
float innerRadius =
|
|
71
|
+
(u_radius - borderWidth) / u_scale * v_scale_fade * u_scale_transition;
|
|
72
|
+
|
|
73
|
+
// Pass scaled radii to fragment shader (in viewport pixels)
|
|
74
|
+
v_radius = radius * u_scale * u_dpi;
|
|
75
|
+
v_inner_radius = innerRadius * u_scale * u_dpi;
|
|
59
76
|
|
|
60
77
|
// Calculate quad bounds centered on circle position
|
|
61
78
|
float left = circlePos.x - radius;
|