Using hardware acceleration for thumbnails dragging
This commit is contained in:
parent
2baf70f14c
commit
f7770d2b06
@ -86,15 +86,9 @@ const thumbnailDragStartHandler = (event, data) => {
|
|||||||
'z-index': 100000
|
'z-index': 100000
|
||||||
});
|
});
|
||||||
|
|
||||||
if (useTransform === true) {
|
// This sets the default style properties of the cloned element so it is
|
||||||
// This sets the default style properties of the cloned element so it is
|
// ready to be dragged around the page
|
||||||
// ready to be dragged around the page
|
if (useTransform) {
|
||||||
$clone.css({
|
|
||||||
left: cursorX - diff.x,
|
|
||||||
position: 'fixed',
|
|
||||||
top: cursorY - diff.y,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const viewerHeight = $('#viewer').height();
|
const viewerHeight = $('#viewer').height();
|
||||||
const headerHeight = $('.header').outerHeight();
|
const headerHeight = $('.header').outerHeight();
|
||||||
const heightDiff = viewerHeight + headerHeight;
|
const heightDiff = viewerHeight + headerHeight;
|
||||||
@ -107,6 +101,12 @@ const thumbnailDragStartHandler = (event, data) => {
|
|||||||
|
|
||||||
const translation = `translate(${positionX}px, ${positionY}px)`;
|
const translation = `translate(${positionX}px, ${positionY}px)`;
|
||||||
OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation);
|
OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation);
|
||||||
|
} else {
|
||||||
|
$clone.css({
|
||||||
|
left: cursorX - diff.x,
|
||||||
|
position: 'fixed',
|
||||||
|
top: cursorY - diff.y,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,21 +135,21 @@ const thumbnailDragHandler = event => {
|
|||||||
'z-index': 100000
|
'z-index': 100000
|
||||||
});
|
});
|
||||||
|
|
||||||
if (useTransform === true) {
|
// This sets the default style properties of the cloned element so it is
|
||||||
// This sets the default style properties of the cloned element so it is
|
// ready to be dragged around the page
|
||||||
// ready to be dragged around the page
|
if (useTransform) {
|
||||||
$clone.css({
|
|
||||||
left: cursorX - diff.x,
|
|
||||||
position: 'fixed',
|
|
||||||
top: cursorY - diff.y,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const heightDiff = $clone.data('heightDiff');
|
const heightDiff = $clone.data('heightDiff');
|
||||||
const positionX = cursorX - diff.x;
|
const positionX = cursorX - diff.x;
|
||||||
const positionY = cursorY - diff.y - heightDiff;
|
const positionY = cursorY - diff.y - heightDiff;
|
||||||
|
|
||||||
const translation = `translate(${positionX}px, ${positionY}px)`;
|
const translation = `translate(${positionX}px, ${positionY}px)`;
|
||||||
OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation);
|
OHIF.ui.styleProperty.set($clone.get(0), 'transform', translation);
|
||||||
|
} else {
|
||||||
|
$clone.css({
|
||||||
|
left: cursorX - diff.x,
|
||||||
|
position: 'fixed',
|
||||||
|
top: cursorY - diff.y,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identify the element below the current cursor position
|
// Identify the element below the current cursor position
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user