@@ -125,10 +125,20 @@ <h3 x-text="selectedProfileName" class="pointer tooltip has-tooltip-arrow" data-
125
125
< template x-for ="(ability, index) of selectedProfileAbilities ">
126
126
< tr @click ="selectAbility(ability.ability_id) " class ="ability-row "
127
127
x-bind:class ="{ 'orange-row': needsParser.indexOf(ability.name) > -1 ,
128
- 'row-hover': ability.ability_id === abilityTableDragHoverId && abilityTableDragHoverId != undefined,
129
- 'red-row-unclickable': undefinedAbilities.indexOf(ability.ability_id) > -1 } "
130
- x-on:mouseenter ="setAbilityHover(ability.ability_id) " x-on:mouseleave ="clearAbilityHover() " x-on:dragenter ="abilityTableDragHoverId = ability.ability_id ">
131
- < td class ="has-text-centered drag " @click.stop draggable ="true " x-on:dragstart ="startAbilitySwap " x-on:dragover.prevent ="swapAbilitiesHover " x-on:dragend ="swapAbilities "> ☰</ td >
128
+ 'row-hover-above':
129
+ ability.ability_id === abilityTableDragHoverId
130
+ && abilityTableDragHoverId != undefined
131
+ && abilityTableDragEndIndex < abilityTableDragTargetIndex,
132
+ 'row-hover-below':
133
+ ability.ability_id === abilityTableDragHoverId
134
+ && abilityTableDragHoverId != undefined
135
+ && abilityTableDragEndIndex > abilityTableDragTargetIndex,
136
+ 'red-row-unclickable': undefinedAbilities.indexOf(ability.ability_id) > -1 } "
137
+ x-on:mouseenter ="setAbilityHover(ability.ability_id) " x-on:mouseleave ="clearAbilityHover() ">
138
+ < td class ="has-text-centered drag "
139
+ @click.stop draggable ="true " x-on:dragstart ="startAbilitySwap " x-on:dragenter ="abilityTableDragHoverId = ability.ability_id " x-on:dragover.prevent ="swapAbilitiesHover " x-on:dragend ="dragAbility ">
140
+ ☰
141
+ </ td >
132
142
< td >
133
143
< div class ="icon-text ">
134
144
< span x-text ="index + 1 "> </ span >
@@ -820,7 +830,7 @@ <h3>Create a profile</h3>
820
830
// Global page variables
821
831
adversaries : [ ] ,
822
832
abilities : [ ] ,
823
- abilityIDs : [ ] ,
833
+ abilityIDs : [ ] ,
824
834
objectives : [ ] ,
825
835
platforms : JSON . parse ( '{{ platforms | tojson }}' ) ,
826
836
payloads : JSON . parse ( '{{ payloads | tojson }}' ) . sort ( ) ,
@@ -847,6 +857,7 @@ <h3>Create a profile</h3>
847
857
848
858
// Table on drag and drop
849
859
abilityTableDragTarget : undefined ,
860
+ abilityTableDragTargetIndex : undefined ,
850
861
abilityTableDragEndIndex : undefined ,
851
862
abilityTableDragHoverId : undefined ,
852
863
@@ -1404,6 +1415,7 @@ <h3>Create a profile</h3>
1404
1415
1405
1416
startAbilitySwap ( event ) {
1406
1417
this . abilityTableDragTarget = event . target . parentNode ;
1418
+ this . abilityTableDragTargetIndex = parseInt ( this . abilityTableDragTarget . children [ 1 ] . children [ 0 ] . children [ 0 ] . innerHTML , 10 ) ;
1407
1419
} ,
1408
1420
1409
1421
swapAbilitiesHover ( event ) {
@@ -1415,13 +1427,13 @@ <h3>Create a profile</h3>
1415
1427
this . abilityTableDragEndIndex = parseInt ( event . target . parentNode . children [ 1 ] . children [ 0 ] . children [ 0 ] . innerHTML , 10 ) ;
1416
1428
}
1417
1429
} ,
1418
-
1419
- swapAbilities ( event ) {
1420
- const fromIndex = parseInt ( this . abilityTableDragTarget . children [ 1 ] . children [ 0 ] . children [ 0 ] . innerHTML , 10 ) - 1 ;
1430
+
1431
+ dragAbility ( event ) {
1432
+ const fromIndex = this . abilityTableDragTargetIndex - 1 ;
1421
1433
const toIndex = this . abilityTableDragEndIndex - 1 ;
1422
1434
const temp = this . selectedProfileAbilities [ fromIndex ] ;
1423
- this . selectedProfileAbilities [ fromIndex ] = this . selectedProfileAbilities [ toIndex ] ;
1424
- this . selectedProfileAbilities [ toIndex ] = temp ;
1435
+ this . selectedProfileAbilities . splice ( fromIndex , 1 ) ;
1436
+ this . selectedProfileAbilities . splice ( toIndex , 0 , temp ) ;
1425
1437
1426
1438
this . unsavedChanges = true ;
1427
1439
this . abilityTableDragHoverId = undefined ;
@@ -1523,6 +1535,14 @@ <h3>Create a profile</h3>
1523
1535
background-color : # 484848 !important ;
1524
1536
}
1525
1537
1538
+ .row-hover-above {
1539
+ border-top : 2px solid green;
1540
+ }
1541
+
1542
+ .row-hover-below {
1543
+ border-bottom : 2px solid green;
1544
+ }
1545
+
1526
1546
.tactic-breakdown {
1527
1547
display : table;
1528
1548
width : 100% ;
0 commit comments