mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-21 00:21:35 +03:00
only show hunk line grab cursor if dragging is enabled
This commit is contained in:
parent
913d4b0eeb
commit
68d9de295e
@ -11,6 +11,7 @@
|
|||||||
export let selectable: boolean = false;
|
export let selectable: boolean = false;
|
||||||
export let selected: boolean = true;
|
export let selected: boolean = true;
|
||||||
export let readonly: boolean = false;
|
export let readonly: boolean = false;
|
||||||
|
export let draggingDisabled: boolean = false;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ selected: boolean }>();
|
const dispatch = createEventDispatcher<{ selected: boolean }>();
|
||||||
|
|
||||||
@ -63,6 +64,7 @@
|
|||||||
class:readonly
|
class:readonly
|
||||||
class:diff-line-deletion={sectionType === SectionType.RemovedLines}
|
class:diff-line-deletion={sectionType === SectionType.RemovedLines}
|
||||||
class:diff-line-addition={sectionType === SectionType.AddedLines}
|
class:diff-line-addition={sectionType === SectionType.AddedLines}
|
||||||
|
style:cursor={draggingDisabled ? 'default' : 'grab'}
|
||||||
>
|
>
|
||||||
<span class="selectable-wrapper" data-no-drag>
|
<span class="selectable-wrapper" data-no-drag>
|
||||||
{@html toTokens(line.content).join('')}
|
{@html toTokens(line.content).join('')}
|
||||||
@ -82,9 +84,6 @@
|
|||||||
|
|
||||||
.line {
|
.line {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
&:not(.readonly) {
|
|
||||||
cursor: grab;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-line__numbers-line {
|
.code-line__numbers-line {
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
$: popupMenu = updateContextMenu(filePath);
|
$: popupMenu = updateContextMenu(filePath);
|
||||||
|
|
||||||
|
$: draggingDisabled = readonly || isUnapplied || section.hunk.locked || !branchId;
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
if (popupMenu) {
|
if (popupMenu) {
|
||||||
popupMenu.$destroy();
|
popupMenu.$destroy();
|
||||||
@ -55,7 +57,7 @@
|
|||||||
role="cell"
|
role="cell"
|
||||||
use:draggable={{
|
use:draggable={{
|
||||||
...draggableHunk(branchId, section.hunk),
|
...draggableHunk(branchId, section.hunk),
|
||||||
disabled: readonly || isUnapplied || section.hunk.locked || !branchId
|
disabled: draggingDisabled
|
||||||
}}
|
}}
|
||||||
on:contextmenu|preventDefault
|
on:contextmenu|preventDefault
|
||||||
class="hunk"
|
class="hunk"
|
||||||
@ -72,6 +74,7 @@
|
|||||||
{readonly}
|
{readonly}
|
||||||
{minWidth}
|
{minWidth}
|
||||||
{selectable}
|
{selectable}
|
||||||
|
{draggingDisabled}
|
||||||
selected={$selectedOwnership?.containsHunk(hunk.filePath, hunk.id)}
|
selected={$selectedOwnership?.containsHunk(hunk.filePath, hunk.id)}
|
||||||
on:selected={(e) => onHunkSelected(hunk, e.detail)}
|
on:selected={(e) => onHunkSelected(hunk, e.detail)}
|
||||||
sectionType={subsection.sectionType}
|
sectionType={subsection.sectionType}
|
||||||
|
Loading…
Reference in New Issue
Block a user