diff --git a/src/main/mesh.js b/src/main/mesh.js index a88f96e8..2d654e8c 100644 --- a/src/main/mesh.js +++ b/src/main/mesh.js @@ -642,6 +642,12 @@ function set_wireframe_fog(fogx) { prefs.save(); } +function set_snap_value(snap) { + let { prefs } = mesh.api; + prefs.map.space.snap = parseFloat(snap || 1); + prefs.save(); +} + // bind functions to topics broker.listeners({ load_files, @@ -655,7 +661,8 @@ broker.listeners({ set_surface_radians, set_surface_radius, set_wireframe_opacity, - set_wireframe_fog + set_wireframe_fog, + set_snap_value }); // remove version cache bust from url diff --git a/src/mesh/api.js b/src/mesh/api.js index 50b4c21a..6971bdf6 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -1176,6 +1176,8 @@ const prefs = { scale_group_Z: true }, space: { + snap: 1, + snapon: false, center: true, floor: true, wire: false, diff --git a/src/mesh/build.js b/src/mesh/build.js index 1f13eae8..882de41d 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -284,7 +284,20 @@ api.settings = function() { }), ]); - modal.show('settings', h.div({ class: "settings" }, [ set1, set2, set3, set4 ] )); + // const set5 = h.div([ + // h.label({ class: "header", _: 'snap'}), + // h.label('value'), + // h.input({ type: "text", size: 5, value: parseFloat(space.snap || 1), + // onchange: ev => call.set_snap_value(ev.target.value) + // }), + // h.label('enabled'), + // h.input({ type: "checkbox", + // onchange: ev => prefs.save( space.snapon = !space.snapon ), + // [ space.snapon === true ? 'checked' : 'unchecked' ] : 1 + // }), + // ]); + + modal.show('settings', h.div({ class: "settings" }, [ set1, set2, set3, set4, set5 ] )); } // create html elements diff --git a/src/mesh/object.js b/src/mesh/object.js index 7c57b576..13b3beb4 100644 --- a/src/mesh/object.js +++ b/src/mesh/object.js @@ -5,7 +5,7 @@ // dep: add.three // dep: moto.license // dep: moto.broker -// use: mesh.api +// dep: mesh.api // use: mesh.util gapp.register("mesh.object", [], (root, exports) => { diff --git a/src/moto/space.js b/src/moto/space.js index 9a646a7e..6cc6d6b0 100644 --- a/src/moto/space.js +++ b/src/moto/space.js @@ -772,18 +772,18 @@ gapp.register("moto.space", [], (root, exports) => { requestRefresh(); } - function alignTracking(point, rot, out) { - if (point && rot) { - alignedTracking = true; - trackPlane.position.set(point.x, point.y, point.z); - trackPlane.rotation.set(rot.x, rot.y, rot.z); - trackDelta = out; - } else { - alignedTracking = false; - trackPlane.position.set(0, 0, 0); - trackPlane.rotation.set(PI2, 0, 0); - } - } + // function alignTracking(point, rot, out) { + // if (point && rot) { + // alignedTracking = true; + // trackPlane.position.set(point.x, point.y, point.z); + // trackPlane.rotation.set(rot.x, rot.y, rot.z); + // trackDelta = out; + // } else { + // alignedTracking = false; + // trackPlane.position.set(0, 0, 0); + // trackPlane.rotation.set(PI2, 0, 0); + // } + // } function cca(c) { return c.charCodeAt(0); @@ -1100,7 +1100,7 @@ gapp.register("moto.space", [], (root, exports) => { update: requestRefresh, setAntiAlias(b) { antiAlias = b ? true : false }, - alignTracking: alignTracking, + // alignTracking: alignTracking, raycast: intersect, event: {