Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/common/components/tooltip/tooltip.component.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
opacity: 0;
visibility: hidden;
transition:
opacity 0.3s ease,
visibility 0.3s ease;
opacity 0.5s ease,
visibility 0s linear 0.5s,
transform 0.5s ease;
}

.tooltipContainer:hover .tooltip {
.tooltip.visible {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(-2px);
transition-delay: 1s;
}
14 changes: 6 additions & 8 deletions src/common/components/tooltip/tooltip.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ export const Tooltip: React.FC<TooltipProps> = props => {
onMouseLeave={() => setVisible(false)}
>
{children}
{visible && (
<div
className={classes.tooltip}
style={{ left: `${leftPosition}`, bottom: `${bottomPosition}` }}
>
{label}
</div>
)}
<div
className={`${classes.tooltip} ${visible ? classes.visible : ''}`}
style={{ left: leftPosition, bottom: bottomPosition }}
>
{label}
</div>
</div>
);
};
2 changes: 1 addition & 1 deletion src/pods/canvas/canvas.grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const CanvasGridLayer: React.FC<Props> = ({ canvasSize }) => {
}, [width, height, gridSpacing]);

return (
<Layer>
<Layer name="grid">
{/* Render vertical lines */}
{verticalLines.map((points, index) => (
<GridLine key={`v-line-${index}`} points={points} />
Expand Down
5 changes: 5 additions & 0 deletions src/pods/toolbar/components/export-button/export-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const ExportButton = () => {
const originalStage = stageRef.current;
const clonedStage = originalStage.clone();

removeGridLayer(clonedStage);
applyFiltersToImages(clonedStage);
resetScale(clonedStage);

Expand Down Expand Up @@ -53,6 +54,10 @@ export const ExportButton = () => {
});
};

const removeGridLayer = (stage: Konva.Stage) => {
stage.findOne((node: Konva.Node) => node.name() === 'grid')?.visible(false);
};

return (
<ToolbarButton
onClick={handleExport}
Expand Down
48 changes: 30 additions & 18 deletions src/pods/toolbar/components/toolbar-button/toolbar-button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//import { isMacOS } from '@/common/helpers/platform.helpers';
import { useShortcut } from '../../shortcut/shortcut.hook';
/* import { isMacOS } from '@/common/helpers/platform.helpers'; */
import { ShortcutOptions } from '../../shortcut/shortcut.model';
import { Tooltip } from '@/common/components/tooltip';

interface Props {
onClick?: () => void;
Expand All @@ -20,30 +21,41 @@ export const ToolbarButton: React.FC<Props> = props => {
shortcutOptions,
} = props;

/* const shortcutCommand = isMacOS() ? 'Ctrl' : 'Alt';
//const shortcutCommand = isMacOS() ? 'Cmd' : 'Ctrl';
const showTooltip = shortcutOptions && !disabled;
const tooltipText = `(${shortcutCommand} + ${shortcutOptions?.targetKeyLabel})`; */

//const tooltipText = `(${shortcutCommand} + ${shortcutOptions?.targetKeyLabel})`;
const tooltipText = `(${shortcutOptions?.targetKeyLabel})`;
useShortcut({
...shortcutOptions,
targetKey: shortcutOptions?.targetKey || [],
callback: onClick,
});

return (
<button
onClick={onClick}
className={className}
disabled={disabled}
aria-describedby={shortcutOptions?.id}
>
<span aria-hidden={true}>{icon}</span>
<span>{label}</span>
{/* {showTooltip && (
<span role="tooltip" id={shortcutOptions?.id}>
{tooltipText}
</span>
)} */}
</button>
<>
{showTooltip ? (
<Tooltip label={tooltipText} leftPosition="50%" bottomPosition="-60%">
<button
onClick={onClick}
className={className}
disabled={disabled}
aria-describedby={shortcutOptions?.id}
>
<span aria-hidden={true}>{icon}</span>
<span>{label}</span>
</button>
</Tooltip>
) : (
<button
onClick={onClick}
className={className}
disabled={disabled}
aria-describedby={shortcutOptions?.id}
>
<span aria-hidden={true}>{icon}</span>
<span>{label}</span>
</button>
)}
</>
);
};