debug: Do nothing but init a board. Still buggy

This commit is contained in:
Glen Whitney 2024-06-11 20:40:59 -07:00
parent 0bca52ab4e
commit bcbbedbb12
2 changed files with 30 additions and 16 deletions

View File

@ -1,5 +1,5 @@
--- node_modules/jsxgraph/distrib/index.d.ts 2024-04-29 23:05:16.785680814 -0700
+++ tsbuild/deps/jsxgraphcore.d.mts 2024-06-09 10:04:21.396339486 -0700
+++ tsbuild/deps/jsxgraphcore.d.mts 2024-06-11 19:48:54.158169983 -0700
@@ -15,7 +15,7 @@
/**
* JSXGraph in the namespace JXG.
@ -18,7 +18,18 @@
/**
* This registers a new construction element to JSXGraph for the construction via the JXG.Board.create interface.
* @param element The elements name. This is case-insensitive, existing elements with the same name will be overwritten.
@@ -5742,8 +5742,8 @@
@@ -5125,6 +5125,10 @@
export interface ZoomOptions {
/**
+ * Whether it is allowed to zoom
+ */
+ enabled?: boolean;
+ /**
* Horizontal zoom factor (multiplied to Board.zoomX).
*/
factorX?: number;
@@ -5742,8 +5746,8 @@
/**
*
*/
@ -29,7 +40,7 @@
/**
*
@@ -5756,7 +5756,7 @@
@@ -5756,7 +5760,7 @@
/**
* Dump Namespace.
*/
@ -38,7 +49,7 @@
/**
*
@@ -6054,7 +6054,7 @@
@@ -6054,7 +6058,7 @@
/**
* Math Namespace
*/
@ -47,7 +58,7 @@
/**
* This namespace contains algorithms for Boolean operations on paths, i.e. intersection, union and difference of paths.
@@ -6303,11 +6303,4 @@
@@ -6303,11 +6307,4 @@
}
export type touchProperty = string;

View File

@ -89,7 +89,7 @@ type DiscriminatedAPI
jsxApi?: JXG.Board | JXG.View3D
geoApi?: AppletObject
function getApis(api: DynApp, cdata: ConstructionData) : DiscriminatedAPI
function getApis(api: DynApp|undefined, cdata: ConstructionData) : DiscriminatedAPI
if cdata.isJSX then return {jsxApi: api as JXG.Board | JXG.View3D}
else return {geoApi: api as AppletObject}
@ -128,18 +128,20 @@ function postApplets(jApplets: AppletDescription[], codebase = '')
cdata.pivot = pivot
if isJSX
// for now, only use JSXGraph for 3D constructions
board := JXG.JSXGraph.initBoard jApp.id, {
boundingbox:
[-jApp.width-10, jApp.height+10, jApp.width+10, -jApp.height-10],
+zoom,
pan: {+enabled, -needShift},
drag: {+enabled},
-grid }
console.log('Making a board', jApp.id, jApp.width, jApp.height)
board := JXG.JSXGraph.initBoard jApp.id //, {
// boundingbox:
// [-jApp.width-10, jApp.height+10, jApp.width+10, -jApp.height-10],
//}
//zoom: {+enabled, -needShift},
//pan: {+enabled, -needShift},
//drag: {+enabled},
//-grid }
if is3d // redundant for now, but won't be when we use JSXGraph always
depth .= jApp.width
if jApp.height > depth then depth = jApp.height
depth /= 8
view := board.create 'view3d',
view := undefined and //board.create 'view3d',
[ [-jApp.width, -jApp.height],
[2*jApp.width, 2*jApp.height],
[ [-10 + jApp.width/6, 10 + 4*jApp.width/6],
@ -246,7 +248,7 @@ alignTranslation: Record<string, [number, number]|undefined> := {
// api, consulting and extending by side effect the elements that are
// present in that applet
function dispatchJcommand(
api: DynApp,
api: DynApp | undefined,
name: string,
value: string,
cdata: ConstructionData): void
@ -1450,7 +1452,8 @@ jsxHandler: Record<JoyceClass, JSXHandler> :=
coords := vertFlipped args.scalar, cdata
// FIXME: Is something needed here for supporting pivot?
if jsx3d
jsx3d.create 'point3d', coords, {name: elt.jname}
console.log 'Pretend to create point3d', coords, jname
//jsx3d.create 'point3d', coords, {name: jname}
// FIXME: Handle 2d
return.value = {jsxElement, auxiliaries, ends, parts}
line: (elt, api, cdata) => freshAuxEndsParts()