output labels

This commit is contained in:
Mutasem 2021-10-19 11:30:08 +02:00
parent 30ad6020bd
commit b33e84129f

View file

@ -162,6 +162,18 @@ export const getIcon = (name: string): string => {
return ''; return '';
}; };
if (!window.localStorage.getItem('MIN_X_TO_SHOW_OUTPUT_LABEL')) {
window.localStorage.setItem('MIN_X_TO_SHOW_OUTPUT_LABEL', '150');
}
// @ts-ignore
const _MIN_X_TO_SHOW_OUTPUT_LABEL = parseInt(window.localStorage.getItem('MIN_X_TO_SHOW_OUTPUT_LABEL'), 10);
if (!window.localStorage.getItem('MIN_Y_TO_SHOW_OUTPUT_LABEL')) {
window.localStorage.setItem('MIN_Y_TO_SHOW_OUTPUT_LABEL', '100');
}
// @ts-ignore
const _MIN_Y_TO_SHOW_OUTPUT_LABEL = parseInt(window.localStorage.getItem('MIN_Y_TO_SHOW_OUTPUT_LABEL'), 10);
export const showOrHideItemsLabel = (connection: Connection) => { export const showOrHideItemsLabel = (connection: Connection) => {
const overlay = connection.getOverlay('output-items-label'); const overlay = connection.getOverlay('output-items-label');
if (!overlay) { if (!overlay) {
@ -173,7 +185,7 @@ export const showOrHideItemsLabel = (connection: Connection) => {
const diffX = Math.abs(bounds.maxX - bounds.minX); const diffX = Math.abs(bounds.maxX - bounds.minX);
const diffY = Math.abs(bounds.maxY - bounds.minY); const diffY = Math.abs(bounds.maxY - bounds.minY);
if (diffX < 150 && diffY < 100) { if (diffX < _MIN_X_TO_SHOW_OUTPUT_LABEL && diffY < _MIN_Y_TO_SHOW_OUTPUT_LABEL) {
overlay.setVisible(false); overlay.setVisible(false);
} }
else { else {