@@ -41,7 +41,7 @@ type KwicController = IController & {
41
41
active : boolean
42
42
hitsInProgress : number
43
43
hits : number
44
- isReading : boolean
44
+ aligned : boolean
45
45
page : number
46
46
pageEvent : ( page : number ) => void
47
47
onReadingChange : ( ) => void
@@ -78,8 +78,8 @@ type KwicScope = IScope & {
78
78
hpp : string
79
79
hppOptions : string [ ]
80
80
updateHpp : ( ) => void
81
- isReading : boolean
82
- updateReading : ( ) => void
81
+ aligned : boolean
82
+ updateAligned : ( ) => void
83
83
sort : SortMethod
84
84
sortOptions : Record < SortMethod , string >
85
85
updateSort : ( ) => void
@@ -97,17 +97,10 @@ const UPDATE_DELAY = 500
97
97
angular . module ( "korpApp" ) . component ( "kwic" , {
98
98
template : html `
99
99
< div class ="flex flex-wrap items-baseline mb-4 gap-4 bg-gray-100 p-2 ">
100
- < div class ="flex flex-wrap gap-2 ">
101
- {{ "context" | loc:$root.lang }}:
102
- < label >
103
- < input type ="radio " ng-model ="isReading " ng-value ="false " ng-change ="updateReading() " />
104
- {{'context_kwic' | loc:$root.lang}}
105
- </ label >
106
- < label >
107
- < input type ="radio " ng-model ="isReading " ng-value ="true " ng-change ="updateReading() " />
108
- {{'context_reading' | loc:$root.lang}}
109
- </ label >
110
- </ div >
100
+ < label >
101
+ < input type ="checkbox " ng-model ="aligned " ng-value ="false " ng-change ="updateAligned() " />
102
+ {{'context_kwic' | loc:$root.lang}} (< abbr title ="keyword in context "> KWIC</ abbr > )
103
+ </ label >
111
104
< div ng-show ="$ctrl.showSearchOptions ">
112
105
< label >
113
106
{{ "hits_per_page" | loc:$root.lang }}:
@@ -263,11 +256,11 @@ angular.module("korpApp").component("kwic", {
263
256
` ,
264
257
bindings : {
265
258
aborted : "<" ,
259
+ aligned : "<" ,
266
260
loading : "<" ,
267
261
active : "<" ,
268
262
hitsInProgress : "<" ,
269
263
hits : "<" ,
270
- isReading : "<" ,
271
264
page : "<" ,
272
265
pageEvent : "<" ,
273
266
onReadingChange : "<" ,
@@ -314,8 +307,8 @@ angular.module("korpApp").component("kwic", {
314
307
$ctrl . $onChanges = ( changeObj ) => {
315
308
if ( "kwicInput" in changeObj && $ctrl . kwicInput != undefined ) {
316
309
$ctrl . kwic = massageData ( $ctrl . kwicInput )
317
- $ctrl . useContext = $ctrl . isReading || $location . search ( ) [ "in_order" ] != null
318
- if ( ! $ctrl . isReading ) {
310
+ $ctrl . useContext = ! $ctrl . aligned || $location . search ( ) [ "in_order" ] != null
311
+ if ( $ctrl . aligned ) {
319
312
$timeout ( ( ) => {
320
313
centerScrollbar ( )
321
314
$element . find ( ".match" ) . children ( ) . first ( ) . click ( )
@@ -330,7 +323,7 @@ angular.module("korpApp").component("kwic", {
330
323
}
331
324
332
325
// TODO Do this when shown the first time (e.g. not if loading with stats tab active)
333
- if ( settings . parallel && ! $ctrl . isReading ) {
326
+ if ( settings . parallel && $ctrl . aligned ) {
334
327
$timeout ( ( ) => alignParallelSentences ( ) )
335
328
}
336
329
if ( $ctrl . kwic . length == 0 ) {
@@ -371,7 +364,7 @@ angular.module("korpApp").component("kwic", {
371
364
}
372
365
}
373
366
374
- if ( "isReading " in changeObj ) $scope . isReading = ! ! $ctrl . isReading
367
+ if ( "aligned " in changeObj ) $scope . aligned = ! ! $ctrl . aligned
375
368
}
376
369
377
370
$ctrl . onKwicClick = ( event ) => {
@@ -405,8 +398,8 @@ angular.module("korpApp").component("kwic", {
405
398
( val ) => ( $scope . sort = val || "" )
406
399
)
407
400
408
- $scope . updateReading = _ . debounce ( ( ) => {
409
- if ( $scope . isReading != $ctrl . isReading ) $ctrl . onReadingChange ( )
401
+ $scope . updateAligned = _ . debounce ( ( ) => {
402
+ if ( $scope . aligned != $ctrl . aligned ) $ctrl . onReadingChange ( )
410
403
} , UPDATE_DELAY )
411
404
412
405
$scope . updateHpp = ( ) => {
@@ -821,9 +814,9 @@ angular.module("korpApp").component("kwic", {
821
814
function selectUpOrDown ( $neighborSentence : JQLite , $searchwords : JQLite ) : JQLite {
822
815
const fallback = $neighborSentence . find ( ".word:last" )
823
816
const currentX = selectionManager . selected . offset ( ) ! . left + selectionManager . selected . width ( ) ! / 2
824
- return $ctrl . isReading
825
- ? getFirstAtCoor ( currentX , $searchwords , fallback )
826
- : getWordAt ( currentX , $neighborSentence )
817
+ return $ctrl . aligned
818
+ ? getWordAt ( currentX , $neighborSentence )
819
+ : getFirstAtCoor ( currentX , $searchwords , fallback )
827
820
}
828
821
829
822
function getFirstAtCoor ( x : number , words : JQLite , fallback : JQLite ) {
0 commit comments