1
1
import { unselect } from './utils/SelectTools' ;
2
2
import DragHandler from './utils/DragHandler' ;
3
3
import NeonView from './NeonView' ;
4
- import { setSelectHelperObjects , dragSelect , clickSelect } from './utils/Select' ;
4
+ import {
5
+ setSelectHelperObjects ,
6
+ dragSelect ,
7
+ clickSelect ,
8
+ } from './utils/Select' ;
5
9
import { setGroupingHighlight } from './utils/Color' ;
6
10
import { TextEditInterface } from './Interfaces' ;
7
- import { ModalWindowView } from './utils/ModalWindow' ;
11
+ import { ModalWindowView } from './utils/ModalWindow' ;
8
12
import { setSettings } from './utils/LocalSettings' ;
9
13
import { setCircleSizeControls } from './DisplayPanel/DisplayControls' ;
10
14
@@ -19,26 +23,33 @@ function formatRaw (rawString: string): string {
19
23
}
20
24
*/
21
25
22
- function selByBBoxListener ( ) : void {
26
+ function selByBBoxListener ( ) : void {
23
27
if ( ! document . getElementById ( 'selByBBox' ) . classList . contains ( 'is-active' ) ) {
24
28
unselect ( ) ;
25
- setSettings ( { selectionMode : 'selByBBox' } ) ;
29
+ setSettings ( { selectionMode : 'selByBBox' } ) ;
26
30
try {
27
31
document . getElementById ( 'moreEdit' ) . innerHTML = '' ;
28
32
document . getElementById ( 'extraEdit' ) . innerHTML = '' ;
29
33
document . getElementById ( 'moreEdit' ) . parentElement . classList . add ( 'hidden' ) ;
30
- document . getElementById ( 'extraEdit' ) . parentElement . classList . add ( 'hidden' ) ;
34
+ document
35
+ . getElementById ( 'extraEdit' )
36
+ . parentElement . classList . add ( 'hidden' ) ;
31
37
} catch ( e ) { }
32
38
document . getElementById ( 'selByBBox' ) . classList . add ( 'is-active' ) ;
33
39
try {
34
40
document . getElementById ( 'selByNc' ) . classList . remove ( 'is-active' ) ;
35
41
document . getElementById ( 'selByNeume' ) . classList . remove ( 'is-active' ) ;
36
42
document . getElementById ( 'selByStaff' ) . classList . remove ( 'is-active' ) ;
37
43
document . getElementById ( 'selBySyllable' ) . classList . remove ( 'is-active' ) ;
38
- document . getElementById ( 'selByLayerElement' ) . classList . remove ( 'is-active' ) ;
44
+ document
45
+ . getElementById ( 'selByLayerElement' )
46
+ . classList . remove ( 'is-active' ) ;
39
47
} catch ( e ) { }
40
48
try {
41
- if ( document . querySelector ( '.highlight-selected' ) . id === 'highlight-selection' ) {
49
+ if (
50
+ document . querySelector ( '.highlight-selected' ) . id ===
51
+ 'highlight-selection'
52
+ ) {
42
53
setGroupingHighlight ( 'syllable' ) ;
43
54
}
44
55
} catch ( e ) { }
@@ -57,19 +68,19 @@ export default class TextEditMode implements TextEditInterface {
57
68
* Constructor for a TextEdit
58
69
* @param neonView - The calling [[NeonView]] for the instance.
59
70
*/
60
- constructor ( neonView : NeonView ) {
71
+ constructor ( neonView : NeonView ) {
61
72
this . neonView = neonView ;
62
73
this . initTextEdit ( ) ;
63
74
}
64
75
65
76
/**
66
- * Set text to edit mode
67
- */
68
- initTextEdit ( ) : void {
77
+ * Set text to edit mode
78
+ */
79
+ initTextEdit ( ) : void {
69
80
const spans = document . getElementById ( 'syl_text' ) . querySelectorAll ( 'span' ) ;
70
81
const modal = this . neonView . modal ;
71
82
spans . forEach ( ( span : HTMLSpanElement ) => {
72
- function selectSylText ( ) : void {
83
+ function selectSylText ( ) : void {
73
84
span . classList . add ( 'selected-to-edit' ) ;
74
85
modal . setModalWindowView ( ModalWindowView . EDIT_TEXT ) ;
75
86
modal . openModalWindow ( ) ;
@@ -89,14 +100,13 @@ export default class TextEditMode implements TextEditInterface {
89
100
} ) ;
90
101
}
91
102
92
-
93
103
/**
94
- * Add the selectByBBox button.
95
- * If neume edit mode is there, add it to the bar with the other select by buttons.
96
- * Otherwise add an invisible button
97
- * since the only edit mode is selectByRect in that case
98
- */
99
- initSelectByBBoxButton ( ) : void {
104
+ * Add the selectByBBox button.
105
+ * If neume edit mode is there, add it to the bar with the other select by buttons.
106
+ * Otherwise add an invisible button
107
+ * since the only edit mode is selectByRect in that case
108
+ */
109
+ initSelectByBBoxButton ( ) : void {
100
110
if ( this . neonView . NeumeEdit !== undefined ) {
101
111
const selByBBox = document . getElementById ( 'selByBBox' ) ;
102
112
if ( selByBBox ) {
@@ -139,28 +149,33 @@ export default class TextEditMode implements TextEditInterface {
139
149
/**
140
150
* Initialize select by bbox mode
141
151
*/
142
- addBBoxListeners ( ) : void {
152
+ addBBoxListeners ( ) : void {
143
153
if ( document . getElementById ( 'selByBBox' ) . classList . contains ( 'is-active' ) ) {
144
154
unselect ( ) ;
145
155
if ( this . neonView . NeumeEdit === undefined ) {
146
156
// just in case
147
- this . dragHandler = new DragHandler ( this . neonView , '.sylTextRect-display' ) ;
157
+ this . dragHandler = new DragHandler (
158
+ this . neonView ,
159
+ '.sylTextRect-display' ,
160
+ ) ;
148
161
setSelectHelperObjects ( this . neonView , this . dragHandler ) ;
149
162
if ( this . neonView . view . constructor . name === 'SingleView' ) {
150
163
clickSelect ( '#mei_output, #mei_output rect' ) ;
151
164
dragSelect ( '#svg_group' ) ;
152
165
} else {
153
- clickSelect ( '.active-page > svg > svg, .active-page > svg > svg rect' ) ;
166
+ clickSelect (
167
+ '.active-page > svg > svg, .active-page > svg > svg rect' ,
168
+ ) ;
154
169
dragSelect ( '.active-page svg' ) ;
155
170
}
156
171
}
157
172
}
158
173
}
159
174
160
175
/**
161
- * Add the bbox circle size slider.
162
- */
163
- initBBoxCircleSlider ( ) : void {
176
+ * Add the bbox circle size slider.
177
+ */
178
+ initBBoxCircleSlider ( ) : void {
164
179
const circleSlider = document . getElementById ( 'bbox-circle-slider' ) ;
165
180
if ( circleSlider ) {
166
181
circleSlider . style . display = '' ;
@@ -169,7 +184,10 @@ export default class TextEditMode implements TextEditInterface {
169
184
170
185
const sliderSection = document . getElementById ( 'display-slider-section' ) ;
171
186
const circleSliderContainer = document . createElement ( 'div' ) ;
172
- circleSliderContainer . classList . add ( 'slider-and-slider-actions-container' , 'display-panel' ) ;
187
+ circleSliderContainer . classList . add (
188
+ 'slider-and-slider-actions-container' ,
189
+ 'display-panel' ,
190
+ ) ;
173
191
circleSliderContainer . style . cursor = 'default' ;
174
192
circleSliderContainer . id = 'bbox-circle-slider' ;
175
193
circleSliderContainer . innerHTML = `
@@ -181,7 +199,7 @@ export default class TextEditMode implements TextEditInterface {
181
199
</div>
182
200
<div class="slider-container">
183
201
<input type="range"
184
- step="1" min="0" max="25 " value="25"
202
+ step="1" min="0" max="50 " value="25"
185
203
aria-labelledby="reset-circle-size"
186
204
class="slider is-fullwidth is-large"
187
205
id="circleSlider"
@@ -191,11 +209,11 @@ export default class TextEditMode implements TextEditInterface {
191
209
<output id="circleOutput" for="circleSlider">25</output>
192
210
</div>` ;
193
211
sliderSection . appendChild ( circleSliderContainer ) ;
194
-
212
+
195
213
if ( this . neonView . NeumeEdit === undefined ) {
196
214
circleSliderContainer . style . display = 'none' ;
197
215
}
198
216
199
217
setCircleSizeControls ( ) ;
200
218
}
201
- }
219
+ }
0 commit comments