Skip to content

Commit

Permalink
fix: fix minors from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlkoch committed Apr 30, 2024
1 parent a7f4a44 commit bb9f693
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/LayerTree/LayerTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface OwnProps {
*
* Compare MDN Docs for Array.prototype.filter: https://mdn.io/array/filter
*/
filterFunction?: (value: any, index: number, array: any[]) => boolean;
filterFunction?: (value: OlLayerBase, index: number, array: OlLayerBase[]) => boolean;

/**
* A LayerGroup the Tree should handle.
Expand Down Expand Up @@ -136,7 +136,7 @@ const LayerTree: React.FC<LayerTreeProps> = ({
childNodes = childLayers
.map(childLayer => treeNodeFromLayer(childLayer))
.filter(childLayer => childLayer !== undefined)
.reverse() as TreeDataNode[];
.toReversed() as TreeDataNode[];
}

return {
Expand All @@ -158,7 +158,7 @@ const LayerTree: React.FC<LayerTreeProps> = ({
return lGroup.getLayers().getArray()
.map(l => treeNodeFromLayer(l))
.filter(n => n !== undefined)
.reverse() as TreeDataNode[];
.toReversed() as TreeDataNode[];
}, [layerGroup, map, treeNodeFromLayer]);

const onChangeResolution = useCallback(() => {
Expand Down Expand Up @@ -307,7 +307,7 @@ const LayerTree: React.FC<LayerTreeProps> = ({
const dropPos = info.node.pos.split('-');
const dropPosition = info.dropPosition;
// The drop position relative to the drop node, inside 0, top -1, bottom 1.
const dropPositionRelative = dropPosition - Number(dropPos[dropPos.length - 1]);
const dropPositionRelative = dropPosition - parseInt(dropPos[dropPos.length - 1], 10);

// Reorder layers
if (!map) {
Expand Down

0 comments on commit bb9f693

Please sign in to comment.