stub in snap but requires more work and validating removal of some mouse dragging code

This commit is contained in:
Stewart Allen 2024-07-26 14:58:08 -04:00
commit caeba6a48d
5 changed files with 38 additions and 16 deletions

View file

@ -642,6 +642,12 @@ function set_wireframe_fog(fogx) {
prefs.save(); prefs.save();
} }
function set_snap_value(snap) {
let { prefs } = mesh.api;
prefs.map.space.snap = parseFloat(snap || 1);
prefs.save();
}
// bind functions to topics // bind functions to topics
broker.listeners({ broker.listeners({
load_files, load_files,
@ -655,7 +661,8 @@ broker.listeners({
set_surface_radians, set_surface_radians,
set_surface_radius, set_surface_radius,
set_wireframe_opacity, set_wireframe_opacity,
set_wireframe_fog set_wireframe_fog,
set_snap_value
}); });
// remove version cache bust from url // remove version cache bust from url

View file

@ -1176,6 +1176,8 @@ const prefs = {
scale_group_Z: true scale_group_Z: true
}, },
space: { space: {
snap: 1,
snapon: false,
center: true, center: true,
floor: true, floor: true,
wire: false, wire: false,

View file

@ -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 // create html elements

View file

@ -5,7 +5,7 @@
// dep: add.three // dep: add.three
// dep: moto.license // dep: moto.license
// dep: moto.broker // dep: moto.broker
// use: mesh.api // dep: mesh.api
// use: mesh.util // use: mesh.util
gapp.register("mesh.object", [], (root, exports) => { gapp.register("mesh.object", [], (root, exports) => {

View file

@ -772,18 +772,18 @@ gapp.register("moto.space", [], (root, exports) => {
requestRefresh(); requestRefresh();
} }
function alignTracking(point, rot, out) { // function alignTracking(point, rot, out) {
if (point && rot) { // if (point && rot) {
alignedTracking = true; // alignedTracking = true;
trackPlane.position.set(point.x, point.y, point.z); // trackPlane.position.set(point.x, point.y, point.z);
trackPlane.rotation.set(rot.x, rot.y, rot.z); // trackPlane.rotation.set(rot.x, rot.y, rot.z);
trackDelta = out; // trackDelta = out;
} else { // } else {
alignedTracking = false; // alignedTracking = false;
trackPlane.position.set(0, 0, 0); // trackPlane.position.set(0, 0, 0);
trackPlane.rotation.set(PI2, 0, 0); // trackPlane.rotation.set(PI2, 0, 0);
} // }
} // }
function cca(c) { function cca(c) {
return c.charCodeAt(0); return c.charCodeAt(0);
@ -1100,7 +1100,7 @@ gapp.register("moto.space", [], (root, exports) => {
update: requestRefresh, update: requestRefresh,
setAntiAlias(b) { antiAlias = b ? true : false }, setAntiAlias(b) { antiAlias = b ? true : false },
alignTracking: alignTracking, // alignTracking: alignTracking,
raycast: intersect, raycast: intersect,
event: { event: {