@@ -194,9 +194,9 @@ class ShapeCreatorView {
194
194
this . _modeSelector = $ ( '#shapeModeSelector' ) ;
195
195
this . _typeSelector = $ ( '#shapeTypeSelector' ) ;
196
196
this . _polyShapeSizeInput = $ ( '#polyShapeSize' ) ;
197
- this . _autoBorderingCheckbox = $ ( '#autoBorderingCheckbox ' ) ;
197
+ this . _commonBordersCheckbox = $ ( '#commonBordersCheckbox ' ) ;
198
198
this . _frameContent = SVG . adopt ( $ ( '#frameContent' ) [ 0 ] ) ;
199
- this . _frameText = SVG . adopt ( $ ( " #frameText" ) [ 0 ] ) ;
199
+ this . _frameText = SVG . adopt ( $ ( ' #frameText' ) [ 0 ] ) ;
200
200
this . _playerFrame = $ ( '#playerFrame' ) ;
201
201
this . _createButton . on ( 'click' , ( ) => this . _controller . switchCreateMode ( false ) ) ;
202
202
this . _drawInstance = null ;
@@ -297,11 +297,13 @@ class ShapeCreatorView {
297
297
}
298
298
} ) ;
299
299
300
- this . _autoBorderingCheckbox . on ( 'change.shapeCreator' , ( e ) => {
300
+ this . _commonBordersCheckbox . on ( 'change.shapeCreator' , ( e ) => {
301
301
if ( this . _drawInstance ) {
302
302
if ( ! e . target . checked ) {
303
- this . _borderSticker . disable ( ) ;
304
- this . _borderSticker = null ;
303
+ if ( this . _borderSticker ) {
304
+ this . _borderSticker . disable ( ) ;
305
+ this . _borderSticker = null ;
306
+ }
305
307
} else {
306
308
this . _borderSticker = new BorderSticker ( this . _drawInstance , this . _frameContent ,
307
309
this . _controller . currentShapes , this . _scale ) ;
@@ -322,15 +324,16 @@ class ShapeCreatorView {
322
324
323
325
if ( this . _polyShapeSize ) {
324
326
let size = this . _polyShapeSize ;
325
- let sizeDecrement = function ( ) {
326
- if ( ! -- size ) {
327
+ const sizeDecrement = function sizeDecrement ( ) {
328
+ size -= 1 ;
329
+ if ( ! size ) {
327
330
numberOfPoints = this . _polyShapeSize ;
328
331
this . _drawInstance . draw ( 'done' ) ;
329
332
}
330
333
} . bind ( this ) ;
331
334
332
- let sizeIncrement = function ( ) {
333
- size ++ ;
335
+ const sizeIncrement = function sizeIncrement ( ) {
336
+ size += 1 ;
334
337
} ;
335
338
336
339
this . _drawInstance . on ( 'drawstart' , sizeDecrement ) ;
@@ -339,6 +342,12 @@ class ShapeCreatorView {
339
342
}
340
343
// Otherwise draw will stop by Ctrl + N press
341
344
345
+ this . _drawInstance . on ( 'drawpoint' , ( ) => {
346
+ if ( this . _borderSticker ) {
347
+ this . _borderSticker . reset ( ) ;
348
+ }
349
+ } ) ;
350
+
342
351
// Callbacks for point scale
343
352
this . _drawInstance . on ( 'drawstart' , this . _rescaleDrawPoints . bind ( this ) ) ;
344
353
this . _drawInstance . on ( 'drawpoint' , this . _rescaleDrawPoints . bind ( this ) ) ;
@@ -359,11 +368,12 @@ class ShapeCreatorView {
359
368
numberOfPoints ++ ;
360
369
} ) ;
361
370
362
- this . _autoBorderingCheckbox [ 0 ] . disabled = false ;
371
+ this . _commonBordersCheckbox . css ( 'display' , '' ) . trigger ( 'change.shapeCreator' ) ;
372
+ this . _commonBordersCheckbox . parent ( ) . css ( 'display' , '' ) ;
363
373
$ ( 'body' ) . on ( 'keydown.shapeCreator' , ( e ) => {
364
374
if ( e . ctrlKey && e . keyCode === 17 ) {
365
- this . _autoBorderingCheckbox [ 0 ] . checked = ! this . _borderSticker ;
366
- this . _autoBorderingCheckbox . trigger ( 'change.shapeCreator' ) ;
375
+ this . _commonBordersCheckbox . prop ( ' checked' , ! this . _borderSticker ) ;
376
+ this . _commonBordersCheckbox . trigger ( 'change.shapeCreator' ) ;
367
377
}
368
378
} ) ;
369
379
@@ -403,8 +413,8 @@ class ShapeCreatorView {
403
413
this . _drawInstance . on ( 'drawstop' , ( ) => {
404
414
this . _frameContent . off ( 'mousedown.shapeCreator' ) ;
405
415
this . _frameContent . off ( 'mousemove.shapeCreator' ) ;
406
- this . _autoBorderingCheckbox [ 0 ] . disabled = true ;
407
- this . _autoBorderingCheckbox [ 0 ] . checked = false ;
416
+ this . _commonBordersCheckbox . css ( 'display' , 'none' ) ;
417
+ this . _commonBordersCheckbox . parent ( ) . css ( 'display' , 'none' ) ;
408
418
$ ( 'body' ) . off ( 'keydown.shapeCreator' ) ;
409
419
if ( this . _borderSticker ) {
410
420
this . _borderSticker . disable ( ) ;
0 commit comments