Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dragging after resizing / rotation #2352

Merged
merged 4 commits into from
May 21, 2019
Merged
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
20 changes: 10 additions & 10 deletions assets/src/components/higher-order/with-amp-story-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const applyWithDispatch = withDispatch( ( dispatch, { clientId, rootClientId, to
getBlockRootClientId,
getBlockOrder,
} = select( 'core/block-editor' );
const { moveBlocksDown, moveBlocksUp, moveBlockToPosition } = dispatch( 'core/block-editor' );
const { moveBlocksDown, moveBlocksUp, moveBlockToPosition, selectBlock } = dispatch( 'core/block-editor' );

const item = getSelectedBlockClientId();
const page = getBlockRootClientId( item );
Expand All @@ -143,9 +143,10 @@ const applyWithDispatch = withDispatch( ( dispatch, { clientId, rootClientId, to
onAnimationDelayChange( value ) {
changeAnimationDelay( page, item, value );
},
startBlockRotation: () => toggleSelection( false ),
stopBlockRotation: () => {
startBlockActions: () => toggleSelection( false ),
stopBlockActions: () => {
toggleSelection( true );
selectBlock( clientId );
},
bringForward: () => moveBlocksDown( clientId, rootClientId ),
sendBackward: () => moveBlocksUp( clientId, rootClientId ),
Expand Down Expand Up @@ -180,7 +181,6 @@ export default createHigherOrderComponent(
isFirst,
currentBlockPosition,
numberOfBlocks,
toggleSelection,
fontSize,
setFontSize,
setAttributes,
Expand All @@ -197,8 +197,8 @@ export default createHigherOrderComponent(
getAnimatedBlocks,
animationAfter,
videoFeaturedImage,
startBlockRotation,
stopBlockRotation,
startBlockActions,
stopBlockActions,
bringForward,
sendBackward,
moveFront,
Expand Down Expand Up @@ -257,10 +257,10 @@ export default createHigherOrderComponent(
minWidth={ MIN_BLOCK_WIDTH }
onResizeStop={ ( value ) => {
setAttributes( value );
toggleSelection( true );
stopBlockActions();
} }
onResizeStart={ () => {
toggleSelection( false );
startBlockActions();
} }
>
<RotatableBox
Expand All @@ -269,14 +269,14 @@ export default createHigherOrderComponent(
className="amp-story-editor__rotate-container"
angle={ rotationAngle }
onRotateStart={ () => {
startBlockRotation();
startBlockActions();
} }
onRotateStop={ ( event, angle ) => {
setAttributes( {
rotationAngle: angle,
} );

stopBlockRotation();
stopBlockActions();
} }
>
<BlockEdit { ...props } />
Expand Down