Skip to content

Commit

Permalink
feat: Add dimension tool in palette in the bottom of the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
aranega committed Jan 14, 2025
1 parent 4f63ede commit 887451d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
11 changes: 11 additions & 0 deletions cryoet_data_portal_neuroglancer/state_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ def combine_json_layers(
"row": 2,
"visible": False,
},
"toolPalettes": {
"Dimensions": {
"side": "bottom",
"row": 1,
"tools": [
{"type": "dimension", "dimension": "x"},
{"type": "dimension", "dimension": "y"},
{"type": "dimension", "dimension": "z"},
],
},
},
}
if len(image_layers) > 0 and "_position" in image_layers[0]:
combined_json["position"] = image_layers[0]["_position"]
Expand Down
27 changes: 26 additions & 1 deletion tests/test_state_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,33 @@ def test__generate_segmentation_layer_default_values():
assert state["pick"] is False


def test__generate_color_legend():
def test__generate_configuration_default_values():
state = combine_json_layers(layers=[{"type": "image", "volumeRendering": "OK", "name": "myname"}], scale=1.0)

assert "enableLayerColorWidget" in state
assert state["enableLayerColorWidget"] is True

assert "toolPalettes" in state
assert len(state["toolPalettes"]) == 1

palette = state["toolPalettes"]["Dimensions"]
assert palette.get("side") == "bottom"
assert palette.get("row") == 1
assert len(palette.get("tools", [])) == 3

tools = palette["tools"]
assert "type" in tools[0]
assert "type" in tools[1]
assert "type" in tools[2]

assert tools[0]["type"] == "dimension"
assert tools[1]["type"] == "dimension"
assert tools[2]["type"] == "dimension"

assert "dimension" in tools[0]
assert "dimension" in tools[1]
assert "dimension" in tools[2]

assert tools[0]["dimension"] == "x"
assert tools[1]["dimension"] == "y"
assert tools[2]["dimension"] == "z"

0 comments on commit 887451d

Please sign in to comment.