@geode/opengeodeweb-front 12.2.0-rc.2 → 12.2.0-rc.4
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/.build/tests/browser/helpers/image.js +25 -0
- package/.build/tests/browser/helpers/object_trees/common.js +3 -1
- package/.build/tests/browser/helpers/object_trees/model_tree_bar.js +41 -0
- package/.build/tests/browser/helpers/wait_for_action_settled.js +2 -2
- package/.build/tests/browser/suites/image/raster_image.js +33 -0
- package/.build/tests/browser/suites/index.js +4 -0
- package/.build/tests/browser/suites/model/collections.js +1 -1
- package/.build/tests/browser/suites/object_tree/controls.js +2 -1
- package/.build/tests/browser/suites/object_tree/model_tree_bar.js +81 -0
- package/app/components/Viewer/Image/ImageOptions.vue +67 -0
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +12 -1
- package/app/components/Viewer/ObjectTree/Base/Controls.vue +26 -2
- package/app/components/Viewer/ObjectTree/Box.vue +30 -5
- package/app/components/Viewer/ObjectTree/Layout.vue +183 -54
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +3 -2
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/model_tree_drag.ts +56 -0
- package/app/composables/use_adaptive_styles.ts +15 -8
- package/app/composables/use_overlapping_picker.ts +6 -1
- package/app/composables/virtual_tree.ts +7 -1
- package/app/stores/data_style.ts +12 -1
- package/app/stores/menu_helpers/image.ts +11 -0
- package/app/stores/menu_helpers/menus_data.ts +2 -0
- package/app/stores/treeview.ts +29 -1
- package/app/types/identifiers.ts +8 -0
- package/app/utils/default_styles/images.ts +16 -0
- package/app/utils/default_styles/index.ts +3 -2
- package/app/utils/threshold_sources.ts +5 -1
- package/internal/stores/data_style/image/index.ts +107 -0
- package/internal/stores/hybrid_viewer/brightness.ts +36 -19
- package/package.json +1 -1
- package/tests/browser/helpers/image.ts +33 -0
- package/tests/browser/helpers/object_trees/common.ts +4 -0
- package/tests/browser/helpers/object_trees/model_tree_bar.ts +78 -0
- package/tests/browser/helpers/wait_for_action_settled.ts +2 -3
- package/tests/browser/suites/image/raster_image.ts +40 -0
- package/tests/browser/suites/model/collections.ts +2 -1
- package/tests/browser/suites/object_tree/controls.ts +3 -0
- package/tests/browser/suites/object_tree/model_tree_bar.ts +125 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { waitForActionSettled } from "./wait_for_action_settled.js";
|
|
2
|
+
import { moveMouseOutOfTheWay } from "./app_interaction.js";
|
|
3
|
+
import { openDataContextMenu } from "./object_trees/main_object_tree.js";
|
|
4
|
+
import { ensureMenuOpen } from "./viewer_menu.js";
|
|
5
|
+
import "./viewer_interaction.js";
|
|
6
|
+
//#region tests/browser/helpers/image.ts
|
|
7
|
+
const IMAGE_MENU_TEST_ID = "imageMenu";
|
|
8
|
+
async function openImageMenu(window, geodeObjectType, dataName) {
|
|
9
|
+
await openDataContextMenu(window, geodeObjectType, dataName);
|
|
10
|
+
await ensureMenuOpen(window, IMAGE_MENU_TEST_ID);
|
|
11
|
+
}
|
|
12
|
+
async function setImageOpacity(window, opacity) {
|
|
13
|
+
await ensureMenuOpen(window, IMAGE_MENU_TEST_ID);
|
|
14
|
+
const track = window.getByTestId("imageOpacitySlider").locator(".v-slider").first();
|
|
15
|
+
const box = await track.boundingBox();
|
|
16
|
+
if (!box) throw new Error("Could not get bounding box of the image opacity slider");
|
|
17
|
+
await track.click({ position: {
|
|
18
|
+
x: box.width * opacity,
|
|
19
|
+
y: box.height / 2
|
|
20
|
+
} });
|
|
21
|
+
await moveMouseOutOfTheWay(window);
|
|
22
|
+
await waitForActionSettled(window);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { IMAGE_MENU_TEST_ID, openImageMenu, setImageOpacity };
|
|
@@ -43,7 +43,9 @@ async function toggleSearchObjects(window) {
|
|
|
43
43
|
await waitForActionSettled(window);
|
|
44
44
|
}
|
|
45
45
|
async function fillSearchQuery(window, query, tree) {
|
|
46
|
-
|
|
46
|
+
const searchInput = tree.getByTestId("searchObjectsInput").locator("input");
|
|
47
|
+
if (!await searchInput.isVisible()) await tree.getByTestId("searchObjectsButton").click();
|
|
48
|
+
await searchInput.fill(query);
|
|
47
49
|
await moveMouseOutOfTheWay(window);
|
|
48
50
|
await waitForActionSettled(window);
|
|
49
51
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { waitForActionSettled } from "../wait_for_action_settled.js";
|
|
2
|
+
import { moveMouseOutOfTheWay } from "../app_interaction.js";
|
|
3
|
+
import { getModelComponentsObjectTree } from "./model_components_object_tree.js";
|
|
4
|
+
//#region tests/browser/helpers/object_trees/model_tree_bar.ts
|
|
5
|
+
const DRAG_STEPS = 10;
|
|
6
|
+
function getModelTreeToggles(window) {
|
|
7
|
+
return window.getByTestId("modelTreeToggle");
|
|
8
|
+
}
|
|
9
|
+
function getModelTreeRows(window) {
|
|
10
|
+
return getModelComponentsObjectTree(window).getByTestId("treeRowWrapper");
|
|
11
|
+
}
|
|
12
|
+
async function clickModelTreeBarButton(window, locator) {
|
|
13
|
+
await locator.click();
|
|
14
|
+
await moveMouseOutOfTheWay(window);
|
|
15
|
+
await waitForActionSettled(window);
|
|
16
|
+
}
|
|
17
|
+
async function getModelTreePanelColors(window) {
|
|
18
|
+
return await window.locator(".tree-box").evaluateAll((boxes) => boxes.map((box) => {
|
|
19
|
+
if (box instanceof HTMLElement) return box.style.getPropertyValue("--tree-box-accent");
|
|
20
|
+
return "";
|
|
21
|
+
}).filter((color) => color !== ""));
|
|
22
|
+
}
|
|
23
|
+
async function getModelTreeButtonColors(window) {
|
|
24
|
+
return await getModelTreeToggles(window).evaluateAll((toggles) => toggles.map((toggle) => {
|
|
25
|
+
if (toggle instanceof HTMLElement) return toggle.style.getPropertyValue("--model-tree-color");
|
|
26
|
+
return "";
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
async function dragModelTreeButton(window, fromIndex, toIndex) {
|
|
30
|
+
const source = await getModelTreeToggles(window).nth(fromIndex).boundingBox();
|
|
31
|
+
const target = await getModelTreeToggles(window).nth(toIndex).boundingBox();
|
|
32
|
+
if (source === null || target === null) throw new Error("The model buttons are not displayed.");
|
|
33
|
+
await window.mouse.move(source.x + source.width / 2, source.y + source.height / 2);
|
|
34
|
+
await window.mouse.down();
|
|
35
|
+
await window.mouse.move(target.x + target.width / 2, target.y + target.height / 2, { steps: DRAG_STEPS });
|
|
36
|
+
await window.mouse.up();
|
|
37
|
+
await moveMouseOutOfTheWay(window);
|
|
38
|
+
await waitForActionSettled(window);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { clickModelTreeBarButton, dragModelTreeButton, getModelTreeButtonColors, getModelTreePanelColors, getModelTreeRows, getModelTreeToggles };
|
|
@@ -16,7 +16,7 @@ async function isMicroservicesBusy(window) {
|
|
|
16
16
|
const MUTATION_QUIET_MS = 250;
|
|
17
17
|
const MUTATION_POLL_INTERVAL_MS = 20;
|
|
18
18
|
async function waitForDomSettled(window, budgetMs) {
|
|
19
|
-
await window.evaluate((
|
|
19
|
+
await window.evaluate(() => {
|
|
20
20
|
globalThis.e2eLastMutationAt = performance.now();
|
|
21
21
|
if (!globalThis.e2eMutationObserver) {
|
|
22
22
|
const observer = new MutationObserver(() => {
|
|
@@ -29,7 +29,7 @@ async function waitForDomSettled(window, budgetMs) {
|
|
|
29
29
|
});
|
|
30
30
|
globalThis.e2eMutationObserver = observer;
|
|
31
31
|
}
|
|
32
|
-
}
|
|
32
|
+
});
|
|
33
33
|
await window.waitForFunction((quietMs) => performance.now() - (globalThis.e2eLastMutationAt ?? 0) >= quietMs, MUTATION_QUIET_MS, {
|
|
34
34
|
polling: MUTATION_POLL_INTERVAL_MS,
|
|
35
35
|
timeout: budgetMs
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __exportAll } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { closeAllMenus } from "../../helpers/app_interaction.js";
|
|
3
|
+
import { expandMainObjectTree } from "../../helpers/object_trees/main_object_tree.js";
|
|
4
|
+
import { setVisibilityGeneric } from "../../helpers/viewer_menu.js";
|
|
5
|
+
import "../../helpers/viewer_interaction.js";
|
|
6
|
+
import { IMAGE_MENU_TEST_ID, openImageMenu, setImageOpacity } from "../../helpers/image.js";
|
|
7
|
+
//#region tests/browser/suites/image/raster_image.ts
|
|
8
|
+
var raster_image_exports = /* @__PURE__ */ __exportAll({ registerTests: () => registerTests });
|
|
9
|
+
const inputFilename = "test_texture.png";
|
|
10
|
+
const dataName = "test_texture";
|
|
11
|
+
const geodeObjectType = "RasterImage2D";
|
|
12
|
+
const halfOpacity = .5;
|
|
13
|
+
function registerTests({ test, loadTestDatas }) {
|
|
14
|
+
test.describe.configure({ mode: "serial" });
|
|
15
|
+
test("load shows the image colors", async ({ window }) => {
|
|
16
|
+
await loadTestDatas(window, [inputFilename]);
|
|
17
|
+
await expandMainObjectTree(window);
|
|
18
|
+
});
|
|
19
|
+
test("image menu", async ({ window }) => {
|
|
20
|
+
await openImageMenu(window, geodeObjectType, dataName);
|
|
21
|
+
});
|
|
22
|
+
test("image opacity", async ({ window }) => {
|
|
23
|
+
await setImageOpacity(window, halfOpacity);
|
|
24
|
+
});
|
|
25
|
+
test("image hidden", async ({ window }) => {
|
|
26
|
+
await setVisibilityGeneric(window, IMAGE_MENU_TEST_ID, "imageVisibilitySwitch", false);
|
|
27
|
+
});
|
|
28
|
+
test("close image menu", async ({ window }) => {
|
|
29
|
+
await closeAllMenus(window);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { raster_image_exports, registerTests };
|
|
@@ -2,6 +2,7 @@ import { crs_exports } from "./crs.js";
|
|
|
2
2
|
import { crs_harmonize_exports } from "./crs_harmonize.js";
|
|
3
3
|
import { crs_shortlist_exports } from "./crs_shortlist.js";
|
|
4
4
|
import { grid_scale_exports } from "./grid_scale.js";
|
|
5
|
+
import { raster_image_exports } from "./image/raster_image.js";
|
|
5
6
|
import { edged_curve_exports } from "./mesh/edged_curve.js";
|
|
6
7
|
import { grid2d_exports } from "./mesh/grid2d.js";
|
|
7
8
|
import { grid3d_exports } from "./mesh/grid3d.js";
|
|
@@ -22,6 +23,7 @@ import { surfaces_exports } from "./model/surfaces.js";
|
|
|
22
23
|
import { component_relations_exports } from "./object_tree/component_relations.js";
|
|
23
24
|
import { controls_exports } from "./object_tree/controls.js";
|
|
24
25
|
import { group_context_menu_exports } from "./object_tree/group_context_menu.js";
|
|
26
|
+
import { model_tree_bar_exports } from "./object_tree/model_tree_bar.js";
|
|
25
27
|
import { multi_type_import_exports } from "./object_tree/multi_type_import.js";
|
|
26
28
|
import { time_series_exports } from "./time_series.js";
|
|
27
29
|
//#region tests/browser/suites/index.ts
|
|
@@ -31,6 +33,7 @@ const suites = Object.fromEntries(Object.entries(/* @__PURE__ */ Object.assign({
|
|
|
31
33
|
"./crs_harmonize.ts": crs_harmonize_exports,
|
|
32
34
|
"./crs_shortlist.ts": crs_shortlist_exports,
|
|
33
35
|
"./grid_scale.ts": grid_scale_exports,
|
|
36
|
+
"./image/raster_image.ts": raster_image_exports,
|
|
34
37
|
"./mesh/edged_curve.ts": edged_curve_exports,
|
|
35
38
|
"./mesh/grid2d.ts": grid2d_exports,
|
|
36
39
|
"./mesh/grid3d.ts": grid3d_exports,
|
|
@@ -51,6 +54,7 @@ const suites = Object.fromEntries(Object.entries(/* @__PURE__ */ Object.assign({
|
|
|
51
54
|
"./object_tree/component_relations.ts": component_relations_exports,
|
|
52
55
|
"./object_tree/controls.ts": controls_exports,
|
|
53
56
|
"./object_tree/group_context_menu.ts": group_context_menu_exports,
|
|
57
|
+
"./object_tree/model_tree_bar.ts": model_tree_bar_exports,
|
|
54
58
|
"./object_tree/multi_type_import.ts": multi_type_import_exports,
|
|
55
59
|
"./time_series.ts": time_series_exports
|
|
56
60
|
})).map(([file, { registerTests }]) => [SUITE_PATH_REGEX.exec(file)?.groups?.name ?? file, registerTests]));
|
|
@@ -13,7 +13,7 @@ import { expect } from "@playwright/test";
|
|
|
13
13
|
var collections_exports = /* @__PURE__ */ __exportAll({ registerTests: () => registerTests });
|
|
14
14
|
const structuralModelFilename = "test.og_strm";
|
|
15
15
|
const collectionTypeRowName = "ModelBoundaries";
|
|
16
|
-
const collectionRowName = "019ea684-
|
|
16
|
+
const collectionRowName = "019ea684-37";
|
|
17
17
|
const vertexAttributeName = "test_vertex";
|
|
18
18
|
function registerTests({ test, loadTestDatas }) {
|
|
19
19
|
test.describe.configure({ mode: "serial" });
|
|
@@ -2,7 +2,7 @@ import { __exportAll } from "../../../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { brepGeodeObjectType } from "../../helpers/constants.js";
|
|
3
3
|
import { waitForActionSettled } from "../../helpers/wait_for_action_settled.js";
|
|
4
4
|
import { closeAllMenus, moveMouseOutOfTheWay } from "../../helpers/app_interaction.js";
|
|
5
|
-
import { checkFilterCategory, copyTreeRowId, fillSearchQuery, getTreeRowId, hideObjectInTree, openFilterMenu, toggleSearchObjects, toggleSortObjects, uncheckFilterCategory } from "../../helpers/object_trees/common.js";
|
|
5
|
+
import { checkFilterCategory, copyTreeRowId, expandGeodeObjectTypeInTree, fillSearchQuery, getTreeRowId, hideObjectInTree, openFilterMenu, toggleSearchObjects, toggleSortObjects, uncheckFilterCategory } from "../../helpers/object_trees/common.js";
|
|
6
6
|
import { collapseMainObjectTree, getMainObjectTree, toggleObjectsTree } from "../../helpers/object_trees/main_object_tree.js";
|
|
7
7
|
import "../../helpers/viewer_interaction.js";
|
|
8
8
|
import { resetCamera } from "../../helpers/camera_interaction.js";
|
|
@@ -50,6 +50,7 @@ function registerTests({ test, loadTestDatas }) {
|
|
|
50
50
|
});
|
|
51
51
|
test("search by id", async ({ window, screenshotMask }) => {
|
|
52
52
|
const mainObjectTree = getMainObjectTree(window);
|
|
53
|
+
await expandGeodeObjectTypeInTree(window, brepGeodeObjectType, mainObjectTree);
|
|
53
54
|
const brepLabel = mainObjectTree.locator("[data-testid^=\"treeRow-\"]", { hasText: "test" }).first();
|
|
54
55
|
const searchPrefix = (await getTreeRowId(brepLabel, "test")).slice(0, 3);
|
|
55
56
|
await fillSearchQuery(window, searchPrefix, mainObjectTree);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { __exportAll } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { brepGeodeObjectType, defaultDataName, structuralModelGeodeObjectType } from "../../helpers/constants.js";
|
|
3
|
+
import { moveMouseOutOfTheWay } from "../../helpers/app_interaction.js";
|
|
4
|
+
import { fillSearchQuery } from "../../helpers/object_trees/common.js";
|
|
5
|
+
import { collapseMainObjectTreeGroup, expandMainObjectTree, getMainObjectTree } from "../../helpers/object_trees/main_object_tree.js";
|
|
6
|
+
import { expandMeshComponentType, getModelComponentsObjectTree, openModelComponentsTree } from "../../helpers/object_trees/model_components_object_tree.js";
|
|
7
|
+
import { clickModelTreeBarButton, dragModelTreeButton, getModelTreeButtonColors, getModelTreePanelColors, getModelTreeRows, getModelTreeToggles } from "../../helpers/object_trees/model_tree_bar.js";
|
|
8
|
+
import { expect } from "@playwright/test";
|
|
9
|
+
//#region tests/browser/suites/object_tree/model_tree_bar.ts
|
|
10
|
+
var model_tree_bar_exports = /* @__PURE__ */ __exportAll({ registerTests: () => registerTests });
|
|
11
|
+
const brepFilename = "test.og_brep";
|
|
12
|
+
const structuralModelFilename = "test.og_strm";
|
|
13
|
+
function registerTests({ test, loadTestDatas }) {
|
|
14
|
+
test.describe.configure({ mode: "serial" });
|
|
15
|
+
let surfaceRows = 0;
|
|
16
|
+
test("open a model tree with its surfaces expanded", async ({ window }) => {
|
|
17
|
+
test.slow();
|
|
18
|
+
await loadTestDatas(window, [brepFilename]);
|
|
19
|
+
await loadTestDatas(window, [structuralModelFilename]);
|
|
20
|
+
await expandMainObjectTree(window);
|
|
21
|
+
await openModelComponentsTree(window, brepGeodeObjectType, defaultDataName);
|
|
22
|
+
await expandMeshComponentType(window, "Surfaces");
|
|
23
|
+
await moveMouseOutOfTheWay(window);
|
|
24
|
+
surfaceRows = await getModelTreeRows(window).count();
|
|
25
|
+
await expect(getModelTreeToggles(window)).toHaveCount(1);
|
|
26
|
+
});
|
|
27
|
+
test("collapse the model tree from its button", async ({ window }) => {
|
|
28
|
+
await clickModelTreeBarButton(window, window.getByTestId("toggleModelTreeButton"));
|
|
29
|
+
await expect(getModelComponentsObjectTree(window)).toHaveCount(0);
|
|
30
|
+
await expect(getModelTreeToggles(window)).toHaveCount(1);
|
|
31
|
+
});
|
|
32
|
+
test("show the model tree again with its state", async ({ window }) => {
|
|
33
|
+
await clickModelTreeBarButton(window, window.getByTestId("toggleModelTreeButton"));
|
|
34
|
+
await expect(getModelComponentsObjectTree(window)).toHaveCount(1);
|
|
35
|
+
await expect(getModelTreeRows(window)).toHaveCount(surfaceRows);
|
|
36
|
+
});
|
|
37
|
+
test("open a second model tree", async ({ window }) => {
|
|
38
|
+
await openModelComponentsTree(window, structuralModelGeodeObjectType, defaultDataName);
|
|
39
|
+
await expect(getModelComponentsObjectTree(window)).toHaveCount(2);
|
|
40
|
+
await expect(window.getByTestId("toggleAllModelTreesButton")).toBeVisible();
|
|
41
|
+
});
|
|
42
|
+
test("collapse all the model trees", async ({ window }) => {
|
|
43
|
+
await clickModelTreeBarButton(window, window.getByTestId("toggleAllModelTreesButton"));
|
|
44
|
+
await expect(getModelComponentsObjectTree(window)).toHaveCount(0);
|
|
45
|
+
});
|
|
46
|
+
test("show all the model trees", async ({ window }) => {
|
|
47
|
+
await clickModelTreeBarButton(window, window.getByTestId("toggleAllModelTreesButton"));
|
|
48
|
+
await expect(getModelComponentsObjectTree(window)).toHaveCount(2);
|
|
49
|
+
});
|
|
50
|
+
test("reorder the model trees from their buttons", async ({ window }) => {
|
|
51
|
+
const before = await getModelTreePanelColors(window);
|
|
52
|
+
await dragModelTreeButton(window, 1, 0);
|
|
53
|
+
await expect.poll(async () => {
|
|
54
|
+
return await getModelTreePanelColors(window);
|
|
55
|
+
}).toStrictEqual(before.toReversed());
|
|
56
|
+
expect(await getModelTreeButtonColors(window)).toStrictEqual(before.toReversed());
|
|
57
|
+
});
|
|
58
|
+
test("the search takes the keyboard as it opens", async ({ window }) => {
|
|
59
|
+
const mainObjectTree = getMainObjectTree(window);
|
|
60
|
+
await collapseMainObjectTreeGroup(window, brepGeodeObjectType);
|
|
61
|
+
await mainObjectTree.getByTestId("searchObjectsButton").click();
|
|
62
|
+
for (const key of [
|
|
63
|
+
"t",
|
|
64
|
+
"e",
|
|
65
|
+
"s"
|
|
66
|
+
]) await window.keyboard.press(key);
|
|
67
|
+
await expect(mainObjectTree.getByTestId("searchObjectsInput").locator("input")).toHaveValue("tes");
|
|
68
|
+
});
|
|
69
|
+
test("clearing the search folds the groups back", async ({ window }) => {
|
|
70
|
+
const mainObjectTree = getMainObjectTree(window);
|
|
71
|
+
await fillSearchQuery(window, "", mainObjectTree);
|
|
72
|
+
await expect(mainObjectTree.getByTestId("treeRowWrapper").filter({ hasText: defaultDataName })).toHaveCount(1);
|
|
73
|
+
});
|
|
74
|
+
test("leaving an empty search folds it back", async ({ window }) => {
|
|
75
|
+
const searchInput = getMainObjectTree(window).getByTestId("searchObjectsInput").locator("input");
|
|
76
|
+
await searchInput.blur();
|
|
77
|
+
await expect(searchInput).toBeHidden();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { model_tree_bar_exports, registerTests };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Opacity, Visibility } from "@geode/opengeodeweb-viewer/schema_types";
|
|
3
|
+
import ViewerContextMenuItem, {
|
|
4
|
+
type ItemProps,
|
|
5
|
+
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
6
|
+
import type { ImageId } from "@ogw_front/types/identifiers";
|
|
7
|
+
import ViewerOptionsOpacitySlider from "@ogw_front/components/Viewer/Options/Sliders/Opacity.vue";
|
|
8
|
+
import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
9
|
+
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
10
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
11
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
12
|
+
|
|
13
|
+
const dataStyleStore = useDataStyleStore();
|
|
14
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
15
|
+
const { applyBatchStyle } = useBatchStyle();
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
itemProps: ItemProps & { index: number };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { itemProps } = defineProps<Props>();
|
|
22
|
+
|
|
23
|
+
const dataId = toRef(() => itemProps.id);
|
|
24
|
+
|
|
25
|
+
const visibility = computed<Visibility | undefined>({
|
|
26
|
+
get: () => dataStyleStore.imageVisibility(dataId.value),
|
|
27
|
+
set: async (newValue) => {
|
|
28
|
+
if (newValue === undefined) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await applyBatchStyle(dataId.value, (imageId: ImageId) =>
|
|
32
|
+
dataStyleStore.setImageVisibility(imageId, newValue),
|
|
33
|
+
);
|
|
34
|
+
hybridViewerStore.remoteRender();
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const opacity = computed<Opacity | undefined>({
|
|
38
|
+
get: () => dataStyleStore.imageOpacity(dataId.value),
|
|
39
|
+
set: async (newValue) => {
|
|
40
|
+
if (newValue === undefined) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await applyBatchStyle(dataId.value, (imageId: ImageId) =>
|
|
44
|
+
dataStyleStore.setImageOpacity(imageId, newValue),
|
|
45
|
+
);
|
|
46
|
+
hybridViewerStore.remoteRender();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<ViewerContextMenuItem
|
|
53
|
+
data-testid="imageMenu"
|
|
54
|
+
:index="itemProps.index"
|
|
55
|
+
:itemProps="itemProps"
|
|
56
|
+
tooltip="Image options"
|
|
57
|
+
btnIcon="ph-image"
|
|
58
|
+
>
|
|
59
|
+
<template #options>
|
|
60
|
+
<ViewerOptionsVisibilitySwitch data-testid="imageVisibilitySwitch" v-model="visibility" />
|
|
61
|
+
<template v-if="visibility">
|
|
62
|
+
<v-divider class="my-2" />
|
|
63
|
+
<ViewerOptionsOpacitySlider data-testid="imageOpacitySlider" v-model="opacity" />
|
|
64
|
+
</template>
|
|
65
|
+
</template>
|
|
66
|
+
</ViewerContextMenuItem>
|
|
67
|
+
</template>
|
|
@@ -170,6 +170,15 @@ function clearActive(): boolean {
|
|
|
170
170
|
return true;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// Hovering the tree gives it the keyboard, unless a field (its search) is being typed in
|
|
174
|
+
function focusOnHover(): void {
|
|
175
|
+
const { activeElement } = document;
|
|
176
|
+
if (activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
treeWrapper.value?.focus();
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
const { handleKeyDown } = useTreeKeyboardNav(
|
|
174
183
|
displayItems,
|
|
175
184
|
emit as EmitFn,
|
|
@@ -190,7 +199,7 @@ const { handleKeyDown } = useTreeKeyboardNav(
|
|
|
190
199
|
tabindex="0"
|
|
191
200
|
@keydown="handleKeyDown"
|
|
192
201
|
@mousedown="treeWrapper?.focus()"
|
|
193
|
-
@mouseenter="
|
|
202
|
+
@mouseenter="focusOnHover"
|
|
194
203
|
>
|
|
195
204
|
<StickyHeader
|
|
196
205
|
v-if="stickyHeader"
|
|
@@ -299,6 +308,8 @@ const { handleKeyDown } = useTreeKeyboardNav(
|
|
|
299
308
|
cursor: pointer;
|
|
300
309
|
border-radius: var(--ogw-viewer-row-radius, 4px);
|
|
301
310
|
margin: 0 2px;
|
|
311
|
+
/* After the panel gutter, clear of the accent of a model tree */
|
|
312
|
+
margin-left: calc(2px + var(--tree-box-content-inset, 0px));
|
|
302
313
|
}
|
|
303
314
|
|
|
304
315
|
.tree-row-wrapper.is-focused {
|
|
@@ -28,23 +28,43 @@ interface Emits {
|
|
|
28
28
|
const emit = defineEmits<Emits>();
|
|
29
29
|
|
|
30
30
|
const showSearch = ref<boolean>(false);
|
|
31
|
+
const capsule = useTemplateRef("capsule");
|
|
31
32
|
|
|
33
|
+
// The search field takes the focus as soon as it shows, so typing goes straight into it
|
|
32
34
|
watch(
|
|
33
35
|
() => showSearch.value,
|
|
34
|
-
(val) => {
|
|
36
|
+
async (val) => {
|
|
35
37
|
if (!val) {
|
|
36
38
|
emit("update:search", "");
|
|
39
|
+
return;
|
|
37
40
|
}
|
|
41
|
+
await nextTick();
|
|
42
|
+
capsule.value
|
|
43
|
+
?.querySelector<HTMLInputElement>('[data-testid="searchObjectsInput"] input')
|
|
44
|
+
?.focus();
|
|
38
45
|
},
|
|
39
46
|
);
|
|
47
|
+
|
|
48
|
+
// Leaving the toolbar folds an empty search back; a search in progress stays shown with its query
|
|
49
|
+
function onFocusOut(event: FocusEvent): void {
|
|
50
|
+
const next = event.relatedTarget;
|
|
51
|
+
if (next instanceof Node && capsule.value?.contains(next)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (search === "") {
|
|
55
|
+
showSearch.value = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
40
58
|
</script>
|
|
41
59
|
|
|
42
60
|
<template>
|
|
43
61
|
<v-row dense align="center" class="controls-row pa-1 py-0">
|
|
44
62
|
<v-col cols="12">
|
|
45
63
|
<div
|
|
64
|
+
ref="capsule"
|
|
46
65
|
class="controls-capsule d-flex align-center rounded-pill overflow-hidden"
|
|
47
66
|
:class="{ 'is-expanded': showSearch }"
|
|
67
|
+
@focusout="onFocusOut"
|
|
48
68
|
>
|
|
49
69
|
<ActionButton
|
|
50
70
|
data-testid="searchObjectsButton"
|
|
@@ -128,7 +148,11 @@ watch(
|
|
|
128
148
|
<style scoped>
|
|
129
149
|
/* Apps can line the first icon up with the panel header icon (fallbacks: the former look) */
|
|
130
150
|
.controls-row {
|
|
131
|
-
|
|
151
|
+
/* Apps can space the toolbar from the panel header above and the first row below */
|
|
152
|
+
padding-block: var(--ogw-viewer-controls-padding-block, 0px) !important;
|
|
153
|
+
padding-left: calc(
|
|
154
|
+
var(--ogw-viewer-controls-inset, 4px) + var(--tree-box-content-inset, 0px)
|
|
155
|
+
) !important;
|
|
132
156
|
}
|
|
133
157
|
|
|
134
158
|
.controls-capsule {
|
|
@@ -104,7 +104,7 @@ watch(
|
|
|
104
104
|
ref="treeview-box"
|
|
105
105
|
variant="outlined"
|
|
106
106
|
class="tree-box d-flex flex-column"
|
|
107
|
-
:class="{ 'is-highlighted': accent?.highlighted }"
|
|
107
|
+
:class="{ 'is-highlighted': accent?.highlighted, 'has-accent': accent !== undefined }"
|
|
108
108
|
:style="[
|
|
109
109
|
adaptiveStyles,
|
|
110
110
|
{ borderRadius, borderLeft: borderLeft ? undefined : 'none' },
|
|
@@ -191,10 +191,21 @@ watch(
|
|
|
191
191
|
content: "";
|
|
192
192
|
position: absolute;
|
|
193
193
|
inset: 0;
|
|
194
|
-
/* Adaptive glass: apps can tint it (an "r, g, b" triplet)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
/* Adaptive glass: apps can tint it (an "r, g, b" triplet), change its blending and set a minimum opacity, per
|
|
195
|
+
theme (the radial menu's one) */
|
|
196
|
+
background: rgba(
|
|
197
|
+
var(--ogw-viewer-glass-tint, 255, 255, 255),
|
|
198
|
+
max(var(--adaptive-opacity), var(--ogw-viewer-glass-min-opacity, 0))
|
|
199
|
+
);
|
|
200
|
+
/* Apps can replace the adaptive blur and dimming of the backdrop, "none" keeps it sharp */
|
|
201
|
+
backdrop-filter: var(
|
|
202
|
+
--ogw-viewer-glass-backdrop,
|
|
203
|
+
blur(var(--adaptive-blur)) brightness(var(--adaptive-brightness))
|
|
204
|
+
);
|
|
205
|
+
-webkit-backdrop-filter: var(
|
|
206
|
+
--ogw-viewer-glass-backdrop,
|
|
207
|
+
blur(var(--adaptive-blur)) brightness(var(--adaptive-brightness))
|
|
208
|
+
);
|
|
198
209
|
mix-blend-mode: var(--ogw-viewer-glass-blend, lighten);
|
|
199
210
|
z-index: 0;
|
|
200
211
|
pointer-events: none;
|
|
@@ -209,6 +220,17 @@ watch(
|
|
|
209
220
|
z-index: 1;
|
|
210
221
|
}
|
|
211
222
|
|
|
223
|
+
/* Left gutter of the panel content, read by the header, the toolbar and the rows so they keep one column. A model
|
|
224
|
+
tree leaves its accent that room, so the rounded toolbar and row highlights do not slide under it; apps can give
|
|
225
|
+
every panel a gutter, so all the trees line up */
|
|
226
|
+
.tree-box {
|
|
227
|
+
--tree-box-content-inset: var(--ogw-viewer-panel-gutter, 0px);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tree-box.has-accent {
|
|
231
|
+
--tree-box-content-inset: max(6px, var(--ogw-viewer-panel-gutter, 0px));
|
|
232
|
+
}
|
|
233
|
+
|
|
212
234
|
.tree-box-accent {
|
|
213
235
|
position: absolute;
|
|
214
236
|
z-index: 2;
|
|
@@ -234,6 +256,9 @@ watch(
|
|
|
234
256
|
.tree-box-header {
|
|
235
257
|
height: 32px !important;
|
|
236
258
|
padding: 0 var(--ogw-viewer-panel-padding, 10px) !important;
|
|
259
|
+
padding-left: calc(
|
|
260
|
+
var(--ogw-viewer-panel-padding, 10px) + var(--tree-box-content-inset, 0px)
|
|
261
|
+
) !important;
|
|
237
262
|
background-color: rgba(var(--v-theme-surface), 0.05);
|
|
238
263
|
border-bottom: 1px solid rgba(var(--v-theme-on-surface), 0.05);
|
|
239
264
|
flex-shrink: 0;
|