@@ -101,49 +101,45 @@ const ZoomRegionIface =
101101// '/org/gnome/Magnifier/ZoomRegion/zoomer1', etc.
102102let _zoomRegionInstanceCount = 0 ;
103103
104- function CinnamonMagnifier ( ) {
105- this . _init ( ) ;
106- }
107-
108- CinnamonMagnifier . prototype = {
109- _init : function ( ) {
104+ var CinnamonMagnifier = class CinnamonMagnifier {
105+ constructor ( ) {
110106 this . _zoomers = { } ;
111107
112108 this . _dbusImpl = Gio . DBusExportedObject . wrapJSObject ( MagnifierIface , this ) ;
113109 this . _dbusImpl . export ( Gio . DBus . session , MAG_SERVICE_PATH ) ;
114- } ,
110+ }
115111
116112 /**
117113 * setActive:
118114 * @activate : Boolean to activate or de-activate the magnifier.
119115 */
120- setActive : function ( activate ) {
116+ setActive ( activate ) {
121117 Main . magnifier . setActive ( activate ) ;
122- } ,
118+ }
123119
124120 /**
125121 * isActive:
126122 * @return Whether the magnifier is active (boolean).
127123 */
128- isActive : function ( ) {
124+ isActive ( ) {
129125 return Main . magnifier . isActive ( ) ;
130- } ,
126+ }
131127
132128 /**
133129 * showCursor:
134130 * Show the system mouse pointer.
135131 */
136- showCursor : function ( ) {
132+ showCursor ( ) {
137133 Main . magnifier . showSystemCursor ( ) ;
138- } ,
134+ }
139135
140136 /**
141137 * hideCursor:
142138 * Hide the system mouse pointer.
143139 */
144- hideCursor : function ( ) {
140+ hideCursor ( ) {
145141 Main . magnifier . hideSystemCursor ( ) ;
146- } ,
142+ }
147143
148144 /**
149145 * createZoomRegion:
@@ -165,7 +161,7 @@ CinnamonMagnifier.prototype = {
165161 *
166162 * @return The newly created ZoomRegion.
167163 */
168- createZoomRegion : function ( xMagFactor , yMagFactor , roi , viewPort ) {
164+ createZoomRegion ( xMagFactor , yMagFactor , roi , viewPort ) {
169165 let ROI = { x : roi [ 0 ] , y : roi [ 1 ] , width : roi [ 2 ] - roi [ 0 ] , height : roi [ 3 ] - roi [ 1 ] } ;
170166 let viewBox = { x : viewPort [ 0 ] , y : viewPort [ 1 ] , width : viewPort [ 2 ] - viewPort [ 0 ] , height : viewPort [ 3 ] - viewPort [ 1 ] } ;
171167 let realZoomRegion = Main . magnifier . createZoomRegion ( xMagFactor , yMagFactor , ROI , viewBox ) ;
@@ -178,30 +174,30 @@ CinnamonMagnifier.prototype = {
178174 proxyAndZoomRegion . zoomRegion = realZoomRegion ;
179175 this . _zoomers [ objectPath ] = proxyAndZoomRegion ;
180176 return objectPath ;
181- } ,
177+ }
182178
183179 /**
184180 * addZoomRegion:
185181 * Append the given ZoomRegion to the magnifier's list of ZoomRegions.
186182 * @zoomerObjectPath : The object path for the zoom region proxy.
187183 */
188- addZoomRegion : function ( zoomerObjectPath ) {
184+ addZoomRegion ( zoomerObjectPath ) {
189185 let proxyAndZoomRegion = this . _zoomers [ zoomerObjectPath ] ;
190186 if ( proxyAndZoomRegion && proxyAndZoomRegion . zoomRegion ) {
191187 Main . magnifier . addZoomRegion ( proxyAndZoomRegion . zoomRegion ) ;
192188 return true ;
193- }
194- else
189+ } else {
195190 return false ;
196- } ,
191+ }
192+ }
197193
198194 /**
199195 * getZoomRegions:
200196 * Return a list of ZoomRegion object paths for this Magnifier.
201197 * @return : The Magnifier's zoom region list as an array of DBus object
202198 * paths.
203199 */
204- getZoomRegions : function ( ) {
200+ getZoomRegions ( ) {
205201 // There may be more ZoomRegions in the magnifier itself than have
206202 // been added through dbus. Make sure all of them are associated with
207203 // an object path and proxy.
@@ -231,13 +227,13 @@ CinnamonMagnifier.prototype = {
231227 }
232228 } ) ;
233229 return objectPaths ;
234- } ,
230+ }
235231
236232 /**
237233 * clearAllZoomRegions:
238234 * Remove all the zoom regions from this Magnfier's ZoomRegion list.
239235 */
240- clearAllZoomRegions : function ( ) {
236+ clearAllZoomRegions ( ) {
241237 Main . magnifier . clearAllZoomRegions ( ) ;
242238 for ( let objectPath in this . _zoomers ) {
243239 let proxyAndZoomer = this . _zoomers [ objectPath ] ;
@@ -247,86 +243,86 @@ CinnamonMagnifier.prototype = {
247243 delete this . _zoomers [ objectPath ] ;
248244 }
249245 this . _zoomers = { } ;
250- } ,
246+ }
251247
252248 /**
253249 * fullScreenCapable:
254250 * Consult if the Magnifier can magnify in full-screen mode.
255251 * @return Always return true.
256252 */
257- fullScreenCapable : function ( ) {
253+ fullScreenCapable ( ) {
258254 return true ;
259- } ,
255+ }
260256
261257 /**
262258 * setCrosswireSize:
263259 * Set the crosswire size of all ZoomRegions.
264260 * @size : The thickness of each line in the cross wire.
265261 */
266- setCrosswireSize : function ( size ) {
262+ setCrosswireSize ( size ) {
267263 Main . magnifier . setCrosshairsThickness ( size ) ;
268- } ,
264+ }
269265
270266 /**
271267 * getCrosswireSize:
272268 * Get the crosswire size of all ZoomRegions.
273269 * @return : The thickness of each line in the cross wire.
274270 */
275- getCrosswireSize : function ( ) {
271+ getCrosswireSize ( ) {
276272 return Main . magnifier . getCrosshairsThickness ( ) ;
277- } ,
273+ }
278274
279275 /**
280276 * setCrosswireLength:
281277 * Set the crosswire length of all zoom-regions..
282278 * @size : The length of each line in the cross wire.
283279 */
284- setCrosswireLength : function ( length ) {
280+ setCrosswireLength ( length ) {
285281 Main . magnifier . setCrosshairsLength ( length ) ;
286- } ,
282+ }
287283
288284 /**
289285 * setCrosswireSize:
290286 * Set the crosswire size of all zoom-regions.
291287 * @size : The thickness of each line in the cross wire.
292288 */
293- getCrosswireLength : function ( ) {
289+ getCrosswireLength ( ) {
294290 return Main . magnifier . getCrosshairsLength ( ) ;
295- } ,
291+ }
296292
297293 /**
298294 * setCrosswireClip:
299295 * Set if the crosswire will be clipped by the cursor image..
300296 * @clip : Flag to indicate whether to clip the crosswire.
301297 */
302- setCrosswireClip : function ( clip ) {
298+ setCrosswireClip ( clip ) {
303299 Main . magnifier . setCrosshairsClip ( clip ) ;
304- } ,
300+ }
305301
306302 /**
307303 * getCrosswireClip:
308304 * Get the crosswire clip value.
309305 * @return : Whether the crosswire is clipped by the cursor image.
310306 */
311- getCrosswireClip : function ( ) {
307+ getCrosswireClip ( ) {
312308 return Main . magnifier . getCrosshairsClip ( ) ;
313- } ,
309+ }
314310
315311 /**
316312 * setCrosswireColor:
317313 * Set the crosswire color of all ZoomRegions.
318314 * @color : Unsigned int of the form rrggbbaa.
319315 */
320- setCrosswireColor : function ( color ) {
316+ setCrosswireColor ( color ) {
321317 Main . magnifier . setCrosshairsColor ( '#%08x' . format ( color ) ) ;
322- } ,
318+ }
323319
324320 /**
325321 * getCrosswireClip:
326322 * Get the crosswire color of all ZoomRegions.
327323 * @return : The crosswire color as an unsigned int in the form rrggbbaa.
328324 */
329- getCrosswireColor : function ( ) {
325+ getCrosswireColor ( ) {
330326 let colorString = Main . magnifier . getCrosshairsColor ( ) ;
331327 // Drop the leading '#'.
332328 return parseInt ( colorString . slice ( 1 ) , 16 ) ;
@@ -339,17 +335,13 @@ CinnamonMagnifier.prototype = {
339335 * @zoomerObjectPath : String that is the path to a DBus ZoomRegion.
340336 * @zoomRegion : The actual zoom region associated with the object path.
341337 */
342- function CinnamonMagnifierZoomRegion ( zoomerObjectPath , zoomRegion ) {
343- this . _init ( zoomerObjectPath , zoomRegion ) ;
344- }
345-
346- CinnamonMagnifierZoomRegion . prototype = {
347- _init : function ( zoomerObjectPath , zoomRegion ) {
338+ var CinnamonMagnifierZoomRegion = class CinnamonMagnifierZoomRegion {
339+ constructor ( zoomerObjectPath , zoomRegion ) {
348340 this . _zoomRegion = zoomRegion ;
349341
350342 this . _dbusImpl = Gio . DBusExportedObject . wrapJSObject ( ZoomRegionIface , this ) ;
351343 this . _dbusImpl . export ( Gio . DBus . session , zoomerObjectPath ) ;
352- } ,
344+ }
353345
354346 /**
355347 * setMagFactor:
@@ -359,9 +351,9 @@ CinnamonMagnifierZoomRegion.prototype = {
359351 * @yMagFactor : The power to set the vertical magnification factor to
360352 * of the magnified view.
361353 */
362- setMagFactor : function ( xMagFactor , yMagFactor ) {
354+ setMagFactor ( xMagFactor , yMagFactor ) {
363355 this . _zoomRegion . setMagFactor ( xMagFactor , yMagFactor ) ;
364- } ,
356+ }
365357
366358 /**
367359 * getMagFactor:
@@ -370,9 +362,9 @@ CinnamonMagnifierZoomRegion.prototype = {
370362 * magnification. A value of 2.0 means the contents are doubled
371363 * in size, and so on.
372364 */
373- getMagFactor : function ( ) {
365+ getMagFactor ( ) {
374366 return this . _zoomRegion . getMagFactor ( ) ;
375- } ,
367+ }
376368
377369 /**
378370 * setRoi:
@@ -381,10 +373,10 @@ CinnamonMagnifierZoomRegion.prototype = {
381373 * screen to magnify. The values are in screen (unmagnified)
382374 * coordinate space.
383375 */
384- setRoi : function ( roi ) {
376+ setRoi ( roi ) {
385377 let roiObject = { x : roi [ 0 ] , y : roi [ 1 ] , width : roi [ 2 ] - roi [ 0 ] , height : roi [ 3 ] - roi [ 1 ] } ;
386378 this . _zoomRegion . setROI ( roiObject ) ;
387- } ,
379+ }
388380
389381 /**
390382 * getRoi:
@@ -394,12 +386,12 @@ CinnamonMagnifierZoomRegion.prototype = {
394386 * @return an array, [left, top, right, bottom], representing the bounding
395387 * rectangle of what is shown in the magnified view.
396388 */
397- getRoi : function ( ) {
389+ getRoi ( ) {
398390 let roi = this . _zoomRegion . getROI ( ) ;
399391 roi [ 2 ] += roi [ 0 ] ;
400392 roi [ 3 ] += roi [ 1 ] ;
401393 return roi ;
402- } ,
394+ }
403395
404396 /**
405397 * Set the "region of interest" by centering the given screen coordinate
@@ -409,23 +401,23 @@ CinnamonMagnifierZoomRegion.prototype = {
409401 * @return Whether the shift was successful (for GS-mag, this is always
410402 * true).
411403 */
412- shiftContentsTo : function ( x , y ) {
404+ shiftContentsTo ( x , y ) {
413405 this . _zoomRegion . scrollContentsTo ( x , y ) ;
414406 return true ;
415- } ,
407+ }
416408
417409 /**
418410 * moveResize
419411 * Sets the position and size of the ZoomRegion on screen.
420412 * @viewPort Array, [left, top, right, bottom], defining the position and
421413 * size on screen to place the zoom region.
422414 */
423- moveResize : function ( viewPort ) {
415+ moveResize ( viewPort ) {
424416 let viewRect = { x : viewPort [ 0 ] , y : viewPort [ 1 ] , width : viewPort [ 2 ] - viewPort [ 0 ] , height : viewPort [ 3 ] - viewPort [ 1 ] } ;
425417 this . _zoomRegion . setViewPort ( viewRect ) ;
426- } ,
418+ }
427419
428- destroy : function ( ) {
420+ destroy ( ) {
429421 this . _dbusImpl . unexport ( ) ;
430422 }
431423} ;
0 commit comments