mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Set element cursor to grab (#52503)
* Only display grab cursor when editing enabled * Apply grabbing cursor while dragging an element
This commit is contained in:
parent
3c2ef54e04
commit
bf8bb26f63
@ -81,7 +81,10 @@ export class ElementState implements LayerElement {
|
||||
const { vertical, horizontal } = constraint ?? {};
|
||||
const placement = this.options.placement ?? ({} as Placement);
|
||||
|
||||
const editingEnabled = this.getScene()?.isEditingEnabled;
|
||||
|
||||
const style: React.CSSProperties = {
|
||||
cursor: editingEnabled ? 'grab' : 'auto',
|
||||
position: 'absolute',
|
||||
// Minimum element size is 10x10
|
||||
minWidth: '10px',
|
||||
|
@ -415,6 +415,11 @@ export class Scene {
|
||||
?.getSelectedTargets()
|
||||
.includes(selectedTarget.parentElement.parentElement);
|
||||
|
||||
// Apply grabbing cursor while dragging, applyLayoutStylesToDiv() resets it to grab when done
|
||||
if (this.isEditingEnabled && isTargetMoveableElement && this.selecto?.getSelectedTargets().length) {
|
||||
this.selecto.getSelectedTargets()[0].style.cursor = 'grabbing';
|
||||
}
|
||||
|
||||
if (isTargetMoveableElement || isTargetAlreadySelected) {
|
||||
// Prevent drawing selection box when selected target is a moveable element or already selected
|
||||
event.stop();
|
||||
|
Loading…
Reference in New Issue
Block a user