Skip to content

Commit

Permalink
Add layers to new group
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmooney committed Jul 17, 2024
1 parent d6fbaa1 commit 24b2ba2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/base/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export namespace CommandIDs {
export const removeGroup = 'jupytergis:removeGroup';

export const moveLayersToGroup = 'jupytergis:moveLayersToGroup';
export const moveLayerToNewGroup = 'jupyterlab:moveLayerToNewGroup';
export const moveLayerToNewGroup = 'jupytergis:moveLayerToNewGroup';
}

/**
Expand Down Expand Up @@ -192,12 +192,14 @@ export function addCommands(
function newGroupName() {
const input = document.createElement('input');
input.classList.add('jp-gis-left-panel-input');
const panel = document.getElementById('layertreepanel');
input.style.marginLeft = '26px';
const panel = document.getElementById('jp-gis-layer-tree');
if (!panel) {
return;
}

panel.appendChild(input);
input.focus();

return new Promise<string>(resolve => {
input.addEventListener('blur', () => {
Expand All @@ -221,6 +223,7 @@ export function addCommands(

const newName = await newGroupName();
if (!newName) {
console.warn('New name cannot be empty');
return;
}

Expand Down Expand Up @@ -648,7 +651,7 @@ namespace Private {
originalName
);

if (newName.trim() === '') {
if (!newName) {
console.warn('New name cannot be empty');
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/panelview/components/layers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function LayersBodyComponent(props: IBodyProps): JSX.Element {
});

return (
<div id="layertreepanel">
<div id="jp-gis-layer-tree">
{layerTree.map(layer =>
typeof layer === 'string' ? (
<LayerComponent
Expand Down
4 changes: 4 additions & 0 deletions packages/base/style/leftPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@
.jp-gis-layerText {
padding: 3px 0;
}

li .lm-Menu-itemLabel {
text-transform: capitalize;
}

0 comments on commit 24b2ba2

Please sign in to comment.