@@ -4907,7 +4907,6 @@ class Puzzle_iso extends Puzzle_truncated_square {
49074907 }
49084908 }
49094909 }
4910- [ point , k ] = this . create_corners ( point , 0.25 , k ) ;
49114910 // 重複判定
49124911 var renumber = new Array ( point . length ) ;
49134912 for ( var i = 0 ; i < point . length ; i ++ ) {
@@ -5029,7 +5028,9 @@ class Puzzle_iso extends Puzzle_truncated_square {
50295028 }
50305029 }
50315030 }
5032- this . point = this . point_connect_corners ( this . point_fillin_corners ( this . fix_points ( point ) ) ) ;
5031+ point = this . fix_points ( point ) ;
5032+
5033+ this . point = this . point_connect_corners ( this . create_corners ( point , 0.25 , point . length + 1 ) [ 0 ] ) ;
50335034 }
50345035
50355036 reset_frame ( ) {
@@ -5356,54 +5357,48 @@ class Puzzle_iso extends Puzzle_truncated_square {
53565357 if ( this . point [ i2 ] . neighbor . indexOf ( this . point [ i1 ] . neighbor [ j ] ) !== - 1 ) {
53575358 i3 = this . point [ i1 ] . neighbor [ j ] ;
53585359 }
5359- this . ctx . beginPath ( ) ;
5360- if ( this [ pu ] . line [ i ] === 40 ) {
5361- var r = 0.6 ;
5362- var x1 = r * this . point [ i1 ] . x + ( 1 - r ) * this . point [ i3 ] . x ;
5363- var y1 = r * this . point [ i1 ] . y + ( 1 - r ) * this . point [ i3 ] . y ;
5364- var x2 = ( 1 - r ) * this . point [ i3 ] . x + r * this . point [ i2 ] . x ;
5365- var y2 = ( 1 - r ) * this . point [ i3 ] . y + r * this . point [ i2 ] . y ;
5366- this . ctx . moveTo ( x1 , y1 ) ;
5367- this . ctx . lineTo ( this . point [ i3 ] . x , this . point [ i3 ] . y ) ;
5368- this . ctx . lineTo ( x2 , y2 ) ;
5369- } else if ( this [ pu ] . line [ i ] === 30 ) {
5370- var r = 0.15 * this . size ;
5371- var dx = this . point [ i1 ] . x - this . point [ i2 ] . x ;
5372- var dy = this . point [ i1 ] . y - this . point [ i2 ] . y ;
5373- var d = Math . sqrt ( dx ** 2 + dy ** 2 ) ;
5374- this . ctx . moveTo ( this . point [ i1 ] . x - r / d * dy , this . point [ i1 ] . y + r / d * dx ) ;
5375- this . ctx . lineTo ( this . point [ i2 ] . x - r / d * dy , this . point [ i2 ] . y + r / d * dx ) ;
5360+ }
5361+ this . ctx . beginPath ( ) ;
5362+ if ( this [ pu ] . line [ i ] === 40 ) {
5363+ var r = 0.6 ;
5364+ var x1 = r * this . point [ i1 ] . x + ( 1 - r ) * this . point [ i3 ] . x ;
5365+ var y1 = r * this . point [ i1 ] . y + ( 1 - r ) * this . point [ i3 ] . y ;
5366+ var x2 = ( 1 - r ) * this . point [ i3 ] . x + r * this . point [ i2 ] . x ;
5367+ var y2 = ( 1 - r ) * this . point [ i3 ] . y + r * this . point [ i2 ] . y ;
5368+ this . ctx . moveTo ( x1 , y1 ) ;
5369+ this . ctx . lineTo ( this . point [ i3 ] . x , this . point [ i3 ] . y ) ;
5370+ this . ctx . lineTo ( x2 , y2 ) ;
5371+ } else if ( this [ pu ] . line [ i ] === 30 ) {
5372+ var r = 0.15 * this . size ;
5373+ var dx = this . point [ i1 ] . x - this . point [ i2 ] . x ;
5374+ var dy = this . point [ i1 ] . y - this . point [ i2 ] . y ;
5375+ var d = Math . sqrt ( dx ** 2 + dy ** 2 ) ;
5376+ this . ctx . moveTo ( this . point [ i1 ] . x - r / d * dy , this . point [ i1 ] . y + r / d * dx ) ;
5377+ this . ctx . lineTo ( this . point [ i2 ] . x - r / d * dy , this . point [ i2 ] . y + r / d * dx ) ;
5378+ this . ctx . stroke ( ) ;
5379+ this . ctx . moveTo ( this . point [ i1 ] . x + r / d * dy , this . point [ i1 ] . y - r / d * dx ) ;
5380+ this . ctx . lineTo ( this . point [ i2 ] . x + r / d * dy , this . point [ i2 ] . y - r / d * dx ) ;
5381+ } else {
5382+ if ( this . point [ i1 ] . type === 2 || this . point [ i1 ] . type === 3 ) { //for centerline
5383+ this . ctx . moveTo ( this . point [ i2 ] . x , this . point [ i2 ] . y ) ;
5384+ this . ctx . lineTo ( ( this . point [ i1 ] . x + this . point [ i2 ] . x ) * 0.5 , ( this . point [ i1 ] . y + this . point [ i2 ] . y ) * 0.5 ) ;
53765385 this . ctx . stroke ( ) ;
5377- this . ctx . moveTo ( this . point [ i1 ] . x + r / d * dy , this . point [ i1 ] . y - r / d * dx ) ;
5378- this . ctx . lineTo ( this . point [ i2 ] . x + r / d * dy , this . point [ i2 ] . y - r / d * dx ) ;
5379- } else {
5380- if ( this . point [ i1 ] . type === 2 || this . point [ i1 ] . type === 3 ) { //for centerline
5381- this . ctx . moveTo ( this . point [ i2 ] . x , this . point [ i2 ] . y ) ;
5382- this . ctx . lineTo ( ( this . point [ i1 ] . x + this . point [ i2 ] . x ) * 0.5 , ( this . point [ i1 ] . y + this . point [ i2 ] . y ) * 0.5 ) ;
5383- this . ctx . stroke ( ) ;
5384- this . ctx . lineCap = "butt" ;
5385- } else if ( this . point [ i2 ] . type === 2 || this . point [ i2 ] . type === 3 ) {
5386- this . ctx . moveTo ( this . point [ i1 ] . x , this . point [ i1 ] . y ) ;
5387- this . ctx . lineTo ( ( this . point [ i1 ] . x + this . point [ i2 ] . x ) * 0.5 , ( this . point [ i1 ] . y + this . point [ i2 ] . y ) * 0.5 ) ;
5388- this . ctx . stroke ( ) ;
5389- this . ctx . lineCap = "butt" ;
5390- }
5386+ this . ctx . lineCap = "butt" ;
5387+ } else if ( this . point [ i2 ] . type === 2 || this . point [ i2 ] . type === 3 ) {
53915388 this . ctx . moveTo ( this . point [ i1 ] . x , this . point [ i1 ] . y ) ;
5392- this . ctx . lineTo ( this . point [ i3 ] . x , this . point [ i3 ] . y ) ;
5393- this . ctx . lineTo ( this . point [ i2 ] . x , this . point [ i2 ] . y ) ;
5389+ this . ctx . lineTo ( ( this . point [ i1 ] . x + this . point [ i2 ] . x ) * 0.5 , ( this . point [ i1 ] . y + this . point [ i2 ] . y ) * 0.5 ) ;
5390+ this . ctx . stroke ( ) ;
5391+ this . ctx . lineCap = "butt" ;
53945392 }
5395- this . ctx . stroke ( ) ;
5396- } else {
5397- this . ctx . beginPath ( ) ;
53985393 this . ctx . moveTo ( this . point [ i1 ] . x , this . point [ i1 ] . y ) ;
53995394
54005395 // If neighbor then break the line at midpoint or else directly draw a line between two ends (freeline)
54015396 if ( this . point [ i2 ] . adjacent . includes ( parseInt ( i1 ) ) ) {
54025397 this . ctx . lineTo ( this . point [ i3 ] . x , this . point [ i3 ] . y ) ;
54035398 }
54045399 this . ctx . lineTo ( this . point [ i2 ] . x , this . point [ i2 ] . y ) ;
5405- this . ctx . stroke ( ) ;
54065400 }
5401+ this . ctx . stroke ( ) ;
54075402 }
54085403 }
54095404 for ( var i in this [ pu ] . lineE ) {
0 commit comments