Skip to content
Snippets Groups Projects
Commit d1e6960c authored by Chris Garrity's avatar Chris Garrity
Browse files

Modify tile delete button for touch

Prototype of larger delete button for sprites, costumes and sounds to better support touch devices.

I split it out from `CloseButton` as it made the changes simpler, and we may end up going in a different direction (open context menu).
parent f2ac39fe
No related branches found
No related tags found
No related merge requests found
@import "../../css/colors.css";
@import "../../css/units.css";
/* the delete button has .25rem invisible 'slop' around the visible button
to make it easier to tap on a touch device */
.delete-button {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden; /* Mask the icon animation */
width: 2rem;
height: 2rem;
user-select: none;
cursor: pointer;
transition: all 0.15s ease-out;
}
/* .delete-button.large:hover {
transform: scale(1.1, 1.1);
box-shadow: 0 0 0 4px $ui-black-transparent;
} */
.delete-button-visible {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden; /* Mask the icon animation */
width: 1.75rem;
height: 1.75rem;
box-shadow: 0px 0px 0px 2px $motion-transparent;
background-color: $motion-primary;
color: $ui-white;
border-radius: 50%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
user-select: none;
cursor: pointer;
transition: all 0.15s ease-out;
}
.delete-icon {
position: relative;
margin: 0.25rem;
user-select: none;
transform-origin: 50%;
}
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import styles from './delete-button.css';
import deleteIcon from './icon--delete.svg';
const DeleteButton = props => (
<div
aria-label="Delete"
className={classNames(
styles.deleteButton,
props.className
)}
role="button"
tabIndex="0"
onClick={props.onClick}
>
<div className={styles.deleteButtonVisible}>
<img
className={styles.deleteIcon}
src={deleteIcon}
/>
</div>
</div>
);
DeleteButton.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func.isRequired
};
export default DeleteButton;
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -94,16 +94,16 @@
.delete-button {
position: absolute;
top: 0.125rem;
top: -.625rem;
z-index: auto;
}
[dir="ltr"] .delete-button {
right: 0.125rem;
right: -.625rem;
}
[dir="rtl"] .delete-button {
left: 0.125rem;
left: -.625rem;
}
.number {
......
......@@ -2,7 +2,7 @@ import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import CloseButton from '../close-button/close-button.jsx';
import DeleteButton from '../delete-button/delete-button.jsx';
import styles from './sprite-selector-item.css';
import {ContextMenuTrigger} from 'react-contextmenu';
import {DangerousMenuItem, ContextMenu, MenuItem} from '../context-menu/context-menu.jsx';
......@@ -48,9 +48,8 @@ const SpriteSelectorItem = props => (
) : null}
</div>
{(props.selected && props.onDeleteButtonClick) ? (
<CloseButton
<DeleteButton
className={styles.deleteButton}
size={CloseButton.SIZE_SMALL}
onClick={props.onDeleteButtonClick}
/>
) : null }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment