mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
Fix reoder drag zoom misalignment and zoom
Summary: Looks like zoom alignment in general broke, and we also need to account for zoom in commit reodring Reviewed By: quark-zju Differential Revision: D53833156 fbshipit-source-id: 26363094ef84e105b4b85bddf31b4c3c54a32579
This commit is contained in:
parent
c1e6b62579
commit
f58488e2f9
@ -25,6 +25,7 @@ import {is} from 'immutable';
|
||||
import {useRef, useState} from 'react';
|
||||
import {Icon} from 'shared/Icon';
|
||||
import {unwrap} from 'shared/utils';
|
||||
import {getZoomLevel} from 'shared/zoom';
|
||||
|
||||
import './StackEditSubTree.css';
|
||||
|
||||
@ -61,13 +62,15 @@ export function StackEditSubTree(props: ActivateSplitProps): React.ReactElement
|
||||
setReorderState(state);
|
||||
};
|
||||
|
||||
const zoom = getZoomLevel();
|
||||
|
||||
return (x, y, isDragging) => {
|
||||
// Visual update.
|
||||
const draggingDiv = draggingDivRef.current;
|
||||
if (draggingDiv != null) {
|
||||
if (isDragging) {
|
||||
Object.assign(draggingDiv.style, {
|
||||
transform: `translate(${x}px, calc(-50% + ${y}px))`,
|
||||
transform: `translate(${x / zoom}px, calc(-50% + ${y / zoom}px))`,
|
||||
opacity: '1',
|
||||
});
|
||||
} else {
|
||||
|
@ -17,6 +17,7 @@ export function getZoomLevel(): number {
|
||||
if (isNaN(number)) {
|
||||
return 1;
|
||||
}
|
||||
return number;
|
||||
} catch {}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user