Skip to content

Commit

Permalink
fix edit point
Browse files Browse the repository at this point in the history
  • Loading branch information
sytabaresa committed Nov 18, 2023
1 parent 6c6d54c commit 15c98f3
Show file tree
Hide file tree
Showing 5 changed files with 2,050 additions and 1,394 deletions.
2 changes: 1 addition & 1 deletion .typesafe-i18n.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"adapter": "react",
"$schema": "https://unpkg.com/typesafe-i18n@5.25.1/schema/typesafe-i18n.json",
"$schema": "https://unpkg.com/typesafe-i18n@5.26.2/schema/typesafe-i18n.json",
"baseLocale": "en",
"outputPath": "./src/modules/i18n"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
"vite-bundle-visualizer": "^0.10.0",
"vite-plugin-pwa": "^0.16.4",
"vite-plugin-singlefile": "^0.13.5",
"vite-plugin-ssr": "^0.4.133",
"vite-plugin-ssr": "0.4.133",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.33.0",
"workbox-core": "^7.0.0",
"workbox-precaching": "^7.0.0"
}
}
}
4 changes: 2 additions & 2 deletions src/modules/core/tooltips/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function selectOrDrawPoint(ctx: any, event) {
// in that case: separate select and draw logic with states, guards and reducers
if (point) {
objectSelected.push(point)
return { ...ctx, objectSelected, code }
return { ...ctx, objectSelected, code, created: false }
}

// interception and slider in elements
Expand Down Expand Up @@ -74,7 +74,7 @@ export function selectOrDrawPoint(ctx: any, event) {

// push the new selected/created point
objectSelected.push(point)
return { ...ctx, objectSelected, code }
return { ...ctx, objectSelected, code, created: true }
}

function getParamsStrPoint(ob) { //JXG.GeometryElement & JXG.CoordsElement
Expand Down
9 changes: 8 additions & 1 deletion src/modules/core/tooltips/point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,26 @@ class PointTooltip implements TooltipType {
return this.isDrawObject
}

checkSelected = (ctx, event) => {
console.log(ctx)
return !ctx.created
}

machine = createMachine({
idle: state(
transition('CLICK', 'drawObject', reduce(selectOrDrawPoint)),
),
drawObject: state(
immediate('end', guard(this.checkDrawObject), reduce(this.drawObject.bind(this))),
immediate('end'),
immediate('idle', guard(this.checkSelected)),
immediate('end')
),
error: final(),
end: final(),
}, (parentContext: any) => ({
board: parentContext.board,
objectSelected: [],
created: false,
smithMode: parentContext.smithMode,
}))
}
Expand Down
Loading

0 comments on commit 15c98f3

Please sign in to comment.