Skip to content

Commit

Permalink
fix(Hatch): bulge value for each point instead of only writing it in …
Browse files Browse the repository at this point in the history
…the loop level (#122)
  • Loading branch information
ieskudero committed Nov 29, 2022
1 parent 6178746 commit 879808c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/handlers/entity/hatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var drawType = 0
var isPolyline = false
var seed = null
var loop = { references: [], entities: [] }
var polyPoint = null;

export const process = (tuples) => {
return tuples.reduce(
Expand All @@ -25,9 +26,9 @@ export const process = (tuples) => {
case 10:
{
if (status === 'IDLE') entity.elevation.x = parseFloat(value)
else if (status === 'POLYLINE' && isPolyline) {
const point = { x: parseFloat(value), y: 0 }
loop.entities[0].points.push(point)
else if (status === 'POLYLINE') {
polyPoint = Object.create( { x: parseFloat(value), y: 0, bulge: 0 } );
loop.entities[0].points.push(polyPoint)
} else if (status === 'SEED') {
if (!seed) {
seed = { x: 0, y: 0 }
Expand All @@ -40,10 +41,9 @@ export const process = (tuples) => {
case 20:
{
if (status === 'IDLE') entity.elevation.y = parseFloat(value)
else if (status === 'POLYLINE' && isPolyline) {
loop.entities[0].points[loop.entities[0].points.length - 1].y =
parseFloat(value)
} else if (status === 'SEED') {
else if (status === 'POLYLINE')
polyPoint.y =parseFloat(value)
else if (status === 'SEED') {
seed.y = parseFloat(value)
seed = null
} else fillDrawEntity(type, drawType, parseFloat(value))
Expand Down Expand Up @@ -109,7 +109,8 @@ export const process = (tuples) => {
break
case 42:
{
if (isPolyline) loop.bulge = value
if (isPolyline)
polyPoint.bulge = parseFloat( value )
else fillDrawEntity(type, drawType, parseFloat(value))
}
break
Expand Down

0 comments on commit 879808c

Please sign in to comment.