Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat(lsg): when dragging a pattern only the icon should be visible un…
Browse files Browse the repository at this point in the history
…der the cursor
  • Loading branch information
Lasse Küchler committed Dec 18, 2017
1 parent d833658 commit c63db83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/component/container/pattern_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export class PatternListContainer extends React.Component<PatternListContainerPr
@action
protected handleDragStart(e: React.DragEvent<HTMLElement>, pattern: Pattern): void {
const data = pattern.getRelativePath();
e.dataTransfer.dropEffect = 'copy';
e.dataTransfer.setDragImage(
e.currentTarget.querySelector('.pattern__icon') as Element,
12,
12
);
e.dataTransfer.setData('patternPath', data);
}
}
9 changes: 7 additions & 2 deletions src/lsg/patterns/pattern-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ export const PatternListItem: React.StatelessComponent<PatternListItemProps> = p
return (
<StyledPatternListItem onDragStart={handleDragStart} draggable={draggable} onClick={onClick}>
{icon ? (
<StyledSVG>{icon}</StyledSVG>
<StyledSVG className="pattern__icon">{icon}</StyledSVG>
) : (
<StyledIcon name={IconName.Robo} size={IconSize.XS} color={colors.grey70} />
<StyledIcon
className="pattern__icon"
name={IconName.Robo}
size={IconSize.XS}
color={colors.grey70}
/>
)}
{props.children}
</StyledPatternListItem>
Expand Down

0 comments on commit c63db83

Please sign in to comment.