-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applying necessary changes to cadastrapp to support MapStore layout c…
…hanges (#156) * Cadastrapp changes to support new SidebarMenu plugin * Minor fixes and priority change for BurgerMenu * Make cadastrapp write to layout.rightPanel property to make it's possible to track if cadastrapp panel is open. * - Fix of dependency for cadastrapp; - Making menu item toggleable; - Alternative set of actions for cadastrapp when tool should be toggled without affecting drawing status - Close feature editor when cadastrapp is open. - Reset annotation editing session when cadastrapp selection tool is activated. - Toggle cadastrapp tool off when annotation triggers drawing. * Function documentation * Merging epics into one.
- Loading branch information
1 parent
d0ea5e9
commit c0e3237
Showing
9 changed files
with
199 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
} | ||
}, | ||
"dependencies": [ | ||
"BurgerMenu" | ||
"SidebarMenu" | ||
] | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import classnames from "classnames"; | ||
|
||
/** | ||
* Wrapper for DockablePanel with main intension to support applying of custom styling to make dock panels have proper | ||
* offset depending on the sidebars presence on the page | ||
* @memberof components.misc.panels | ||
* @name DockContainer | ||
* @param id {string} - id applied to the container | ||
* @param children {JSX.Element} | ||
* @param dockStyle {object} - style object obtained from mapLayoutValuesSelector and used to calculate offsets | ||
* @param className {string} - class name | ||
* @param style - style object to apply to the container. Can be used to overwrite styles applied by dockStyle calculations | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
const DockContainer = ({ id, children, dockStyle, className, style = {}}) => { | ||
const persistentStyle = { | ||
width: `calc(100% - ${(dockStyle?.right ?? 0) + (dockStyle?.left ?? 0)}px)`, | ||
transform: `translateX(-${(dockStyle?.right ?? 0)}px)`, | ||
pointerEvents: 'none' | ||
}; | ||
return ( | ||
<div id={id} className={classnames({ | ||
...(className ? {[className]: true} : {}), | ||
'dock-container': true | ||
})} style={{...persistentStyle, ...style}}> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DockContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {mapLayoutSelector} from "@mapstore/selectors/maplayout"; | ||
import {memoize} from "lodash"; | ||
|
||
export const boundingSidebarRectSelector = (state) => state.maplayout && state.maplayout.boundingSidebarRect || {}; | ||
|
||
/** | ||
* Retrieve only specific attribute from map layout | ||
* @function | ||
* @memberof selectors.mapLayout | ||
* @param {object} state the state | ||
* @param {object} attributes attributes to retrieve, bool {left: true} | ||
* @param {boolean} isDock flag to use dock paddings instead of toolbar paddings | ||
* @return {object} selected attributes of layout of the map | ||
*/ | ||
export const mapLayoutValuesSelector = memoize((state, attributes = {}, isDock = false) => { | ||
const layout = mapLayoutSelector(state); | ||
const boundingSidebarRect = boundingSidebarRectSelector(state); | ||
return layout && Object.keys(layout).filter(key => | ||
attributes[key]).reduce((a, key) => { | ||
if (isDock) { | ||
return ({...a, [key]: (boundingSidebarRect[key] ?? layout[key])}); | ||
} | ||
return ({...a, [key]: layout[key]}); | ||
}, | ||
{}) || {}; | ||
}, (state, attributes, isDock) => | ||
JSON.stringify(mapLayoutSelector(state)) + | ||
JSON.stringify(boundingSidebarRectSelector(state)) + | ||
JSON.stringify(attributes) + (isDock ? '_isDock' : '')); |