@@ -181,9 +181,9 @@ export class OrbitArc extends HTMLElement {
181
181
getComputedStyle ( this ) . getPropertyValue ( '--o-size-ratio' )
182
182
)
183
183
// calc(var(--o-radius) / var(--o-orbit-number) * var(--o-size-ratio, 1));
184
- const strokeWidth = orbitRadius / orbitNumber * size - ( 0.7 / 2 )
184
+ const strokeWidth = orbitRadius / orbitNumber * size
185
185
const strokeWithPercentage = ( ( strokeWidth / 2 ) * 100 ) / orbitRadius / 2
186
- const gap = ( parseFloat ( getComputedStyle ( this ) . getPropertyValue ( '--o-gap' ) ) + ( 0.7 / 2 ) ) * 2 / orbitNumber * 2 / ( size * 2 ) - ( 0.7 * 2 ) || 0
186
+ const gap = ( parseFloat ( getComputedStyle ( this ) . getPropertyValue ( '--o-gap' ) ) )
187
187
var innerOuter
188
188
189
189
if ( this . classList . contains ( 'outer-orbit' ) ) {
@@ -237,92 +237,58 @@ export class OrbitArc extends HTMLElement {
237
237
const radiusY = realRadius / 1
238
238
let startX , startY , endX , endY , largeArcFlag , startX1 , startY1 , endX1 , endY1 , largeArcFlag1 , dShape , pointX , pointX1 , pointY , pointY1
239
239
let stroke = 0.7
240
- let adjustedGap = gap * 0.5 - ( gap * ( ( strokeWithPercentage - innerOuter ) / 100 ) )
241
- const angleGap = gap * 0.5 + ( gap * ( ( strokeWithPercentage - innerOuter ) / 100 ) )
242
- let adjustedStroke = stroke - ( stroke * ( ( strokeWithPercentage - innerOuter ) / 100 ) )
243
- const angleStroke = stroke * 2 - ( stroke / 4 * ( ( strokeWithPercentage - innerOuter ) / 100 ) ) * orbitNumber * 4 / size * 4
240
+ let fangle = angle * Math . PI / 180
241
+ let adjustedStroke = 0
242
+ const angleStroke = 0
243
+ let bigRadius = radiusX + strokeWithPercentage
244
+ let smallRadius = radiusX - ( strokeWithPercentage / 2 )
245
+
246
+ let bigGap = gap / orbitNumber / 2 / bigRadius
247
+ const smallGap = gap / orbitNumber / 2 / smallRadius
248
+ let startAngle = ( bigGap ) //* (Math.PI / 180)
249
+ // (-90 + adjustedStroke + adjustedGap) * (Math.PI / 180)
250
+ // (-90 + angleStroke + (angleGap)) * (Math.PI / 180)
251
+ let endAngle = ( fangle - bigGap )
252
+ // ((angle - 90 - adjustedStroke - adjustedGap) * Math.PI) / 180
253
+ // ((angle - 90 - angleStroke - (angleGap)) * Math.PI) / 180
254
+
255
+ let startAngle1 = ( smallGap )
256
+ // (-90 + adjustedStroke + adjustedGap) * (Math.PI / 180)
257
+ // (-90 + angleStroke + (angleGap)) * (Math.PI / 180)
258
+ let endAngle1 = ( fangle - smallGap )
259
+ // ((angle - 90 - adjustedStroke - adjustedGap) * Math.PI) / 180
260
+ // ((angle - 90 - angleStroke - (angleGap)) * Math.PI) / 180
244
261
245
262
// upper arc
246
263
// Coordenadas ajustadas para el inicio del arco (gap incluido)
247
- startX = 50 + ( radiusX + strokeWithPercentage ) * Math . cos ( ( - 90 + adjustedStroke + adjustedGap ) * ( Math . PI / 180 ) ) ;
248
- startY = 50 + ( radiusY + strokeWithPercentage ) * Math . sin ( ( - 90 + adjustedStroke + adjustedGap ) * ( Math . PI / 180 ) ) ;
264
+ startX = 50 + bigRadius * Math . cos ( startAngle ) ;
265
+ startY = 50 + bigRadius * Math . sin ( startAngle ) ;
249
266
// Coordenadas ajustadas para el final del arco (gap incluido)
250
- endX = 50 + ( radiusX + strokeWithPercentage ) * Math . cos ( ( ( angle - 90 - adjustedStroke - adjustedGap ) * Math . PI ) / 180 ) ;
251
- endY = 50 + ( radiusY + strokeWithPercentage ) * Math . sin ( ( ( angle - 90 - adjustedStroke - adjustedGap ) * Math . PI ) / 180 ) ;
252
- // Coordenadas ajustadas para el final del arco (gap incluido)
253
- pointX = 50 + ( radiusX + strokeWithPercentage ) * Math . cos ( ( ( angle + 3 - 90 - adjustedStroke - adjustedGap ) * Math . PI ) / 180 ) ;
254
- pointY = 50 + ( radiusY + strokeWithPercentage ) * Math . sin ( ( ( angle + 3 - 90 - adjustedStroke - adjustedGap ) * Math . PI ) / 180 ) ;
267
+ endX = 50 + bigRadius * Math . cos ( endAngle ) ;
268
+ endY = 50 + bigRadius * Math . sin ( endAngle ) ;
269
+
255
270
// Determinación del flag de arco largo
256
271
largeArcFlag = angle <= 180 ? 0 : 1 ;
257
272
258
273
// inner arc
259
274
// Coordenadas ajustadas para el inicio del arco (gap incluido)
260
- startX1 = 50 + ( radiusX - strokeWithPercentage ) * Math . cos ( ( - 90 + angleStroke + ( angleGap ) ) * ( Math . PI / 180 ) ) ;
261
- startY1 = 50 + ( radiusY - strokeWithPercentage ) * Math . sin ( ( - 90 + angleStroke + ( angleGap ) ) * ( Math . PI / 180 ) ) ;
275
+ startX1 = 50 + smallRadius * Math . cos ( startAngle1 ) ;
276
+ startY1 = 50 + smallRadius * Math . sin ( startAngle1 ) ;
262
277
// Coordenadas ajustadas para el final del arco (gap incluido)
263
- endX1 = 50 + ( radiusX - strokeWithPercentage ) * Math . cos ( ( ( angle - 90 - angleStroke - ( angleGap ) ) * Math . PI ) / 180 ) ;
264
- endY1 = 50 + ( radiusY - strokeWithPercentage ) * Math . sin ( ( ( angle - 90 - angleStroke - ( angleGap ) ) * Math . PI ) / 180 ) ;
278
+ endX1 = 50 + smallRadius * Math . cos ( endAngle1 ) ;
279
+ endY1 = 50 + smallRadius * Math . sin ( endAngle1 ) ;
265
280
// Coordenadas ajustadas para el final del arco (gap incluido)
266
- pointX1 = 50 + ( radiusX - strokeWithPercentage ) * Math . cos ( ( ( angle + 3 - 90 - angleStroke - ( angleGap ) ) * Math . PI ) / 180 ) ;
267
- pointY1 = 50 + ( radiusY - strokeWithPercentage ) * Math . sin ( ( ( angle + 3 - 90 - angleStroke - ( angleGap ) ) * Math . PI ) / 180 ) ;
281
+
268
282
// Determinación del flag de arco largo
269
283
largeArcFlag1 = angle <= 180 ? 0 : 1 ;
270
284
271
- // Generación del path SVG
272
- /**
273
- d = `
274
- M ${startX},${startY}
275
- A ${radiusX + strokeWithPercentage},${radiusY + strokeWithPercentage} 0 ${largeArcFlag} 1 ${endX},${endY}
276
- L ${endX1 + startY1 } ${endY1 + 5}
277
- L ${endX1} ${endY1}
278
- A ${radiusX - strokeWithPercentage},${radiusY - strokeWithPercentage} 0 ${largeArcFlag1} 0 ${startX1},${startY1}
279
- L ${startX1 + 5 } ${0}
280
- Z`;
281
-
282
-
283
- L ${(endX + endX1) / 2 + 1} ${(endY + endY1) / 2}
284
-
285
- L ${startX1 + 1 } ${(startY + startY1) / 2}
286
-
287
-
288
- normal
289
- dShape = `
290
- M ${startX},${startY}
291
- A ${radiusX + strokeWithPercentage},${radiusY + strokeWithPercentage} 0 ${largeArcFlag} 1 ${endX},${endY}
292
- L ${endX1} ${endY1}
293
- A ${radiusX - strokeWithPercentage},${radiusY - strokeWithPercentage} 0 ${largeArcFlag1} 0 ${startX1},${startY1}
294
- Z`;
295
-
296
- circulo
297
-
298
- dShape = `
299
- M ${startX},${startY}
300
- A ${radiusX + strokeWithPercentage},${radiusY + strokeWithPercentage} 0 ${largeArcFlag} 1 ${endX},${endY}
301
- A ${(strokeWithPercentage)}, ${(strokeWithPercentage)} 0 0 1 ${endX1},${endY1}
302
- A ${radiusX - strokeWithPercentage},${radiusY - strokeWithPercentage} 0 ${largeArcFlag1} 0 ${startX1},${startY1}
303
- A ${(strokeWithPercentage)}, ${(strokeWithPercentage)} 0 0 1 ${startX},${startY} // 0 0 0 forma conica
304
- Z`;
305
-
306
- arrow
307
-
308
- dShape = `
309
- M ${startX},${startY}
310
- A ${radiusX + strokeWithPercentage},${radiusY + strokeWithPercentage} 0 ${largeArcFlag} 1 ${endX},${endY}
311
- L ${(pointX + pointX1 ) / 2 } ${(pointY + pointY1) / 2}
312
- L ${endX1} ${endY1}
313
- A ${radiusX - strokeWithPercentage},${radiusY - strokeWithPercentage} 0 ${largeArcFlag1} 0 ${startX1},${startY1}
314
- A ${(strokeWithPercentage)}, ${(strokeWithPercentage)} 0 0 1 ${startX},${startY}
315
- L ${startX1 + 3 } ${(startY + startY1) / 2}
316
- Z`;
317
-
318
-
319
- */
285
+ console . log ( gap , smallRadius , bigRadius , smallGap , bigGap )
320
286
dShape = `
321
287
M ${ startX } ,${ startY }
322
- A ${ radiusX + strokeWithPercentage } ,${ radiusY + strokeWithPercentage } 0 ${ largeArcFlag } 1 ${ endX } ,${ endY }
288
+ A ${ bigRadius } ,${ bigRadius } 0 ${ largeArcFlag } 1 ${ endX } ,${ endY }
323
289
324
290
L ${ endX1 } ${ endY1 }
325
- A ${ radiusX - strokeWithPercentage } ,${ radiusY - strokeWithPercentage } 0 ${ largeArcFlag1 } 0 ${ startX1 } ,${ startY1 }
291
+ A ${ smallRadius } ,${ smallRadius } 0 ${ largeArcFlag1 } 0 ${ startX1 } ,${ startY1 }
326
292
327
293
Z` ;
328
294
@@ -427,4 +393,4 @@ function calcularExpresionCSS(cssExpression) {
427
393
return value / divisor
428
394
}
429
395
}
430
- }
396
+ }
0 commit comments