properly enable/disable hover intersects on feature update
This commit is contained in:
parent
7654933826
commit
cc5aeba5fb
4 changed files with 26 additions and 6 deletions
1
app.js
1
app.js
|
|
@ -690,6 +690,7 @@ function getCachedFile(file, fn) {
|
|||
function minify(path) {
|
||||
let code = fs.readFileSync(path);
|
||||
if (path.indexOf("ext/three.js") > 0) {
|
||||
// console.log({skip_min: path});
|
||||
return code;
|
||||
}
|
||||
let mini = uglify.minify(code.toString(), {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// dep: moto.broker
|
||||
// dep: data.local
|
||||
// dep: kiri.utils
|
||||
// dep: kiri.consts
|
||||
|
|
@ -12,6 +13,8 @@ const { consts, utils } = kiri;
|
|||
const { areEqual, parseOpt, encodeOpt, ajax, o2js, js2o } = utils;
|
||||
const { LISTS } = consts;
|
||||
|
||||
let isHover = false;
|
||||
|
||||
const feature = {
|
||||
seed: true, // seed profiles on first use
|
||||
meta: true, // show selected widget metadata
|
||||
|
|
@ -21,14 +24,21 @@ const feature = {
|
|||
device_filter: undefined, // function to limit devices shown
|
||||
drop_group: undefined, // optional array to group multi drop
|
||||
drop_layout: true, // layout on new drop
|
||||
hover: false, // when true fires mouse hover events
|
||||
hoverAdds: false, // when true only searches widget additions
|
||||
on_key: undefined, // function override default key handlers
|
||||
on_load: undefined, // function override file drop loads
|
||||
on_add_stl: undefined, // legacy override stl drop loads
|
||||
work_alerts: true, // allow disabling work progress alerts
|
||||
modes: [ "fdm", "sla", "cam", "laser" ], // enable device modes
|
||||
pmode: consts.PMODES.SPEED // preview modes
|
||||
pmode: consts.PMODES.SPEED, // preview modes
|
||||
// hover: false, // when true fires mouse hover events
|
||||
get hover() {
|
||||
return isHover;
|
||||
},
|
||||
set hover(b) {
|
||||
isHover = b;
|
||||
moto.broker.publish("feature.hover", b);
|
||||
}
|
||||
};
|
||||
|
||||
const devel = {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
// dep: kiri.consts
|
||||
// dep: kiri.platform
|
||||
// dep: kiri.selection
|
||||
// use: kiri.tools
|
||||
// use: kiri.pack
|
||||
gapp.register("kiri.init", [], (root, exports) => {
|
||||
|
||||
|
|
@ -2359,15 +2360,20 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
api.platform.update_size();
|
||||
|
||||
space.mouse.onHover((int, event, ints) => {
|
||||
function mouseOnHover(int, event, ints) {
|
||||
if (!api.feature.hover) return;
|
||||
if (!int) return api.feature.hovers || api.widgets.meshes();
|
||||
api.event.emit('mouse.hover', {int, ints, event, point: int.point, type: 'widget'});
|
||||
});
|
||||
}
|
||||
|
||||
space.platform.onHover((int, event) => {
|
||||
function platformOnHover(int, event) {
|
||||
if (!api.feature.hover) return;
|
||||
if (int) api.event.emit('mouse.hover', {point: int, event, type: 'platform'});
|
||||
}
|
||||
|
||||
api.event.on("feature.hover", enable => {
|
||||
space.mouse.onHover(enable ? mouseOnHover : undefined);
|
||||
space.platform.onHover(enable ? platformOnHover : undefined);
|
||||
});
|
||||
|
||||
// block standard browser context menu
|
||||
|
|
|
|||
|
|
@ -785,7 +785,10 @@ gapp.register("moto.space", [], (root, exports) => {
|
|||
}
|
||||
|
||||
function intersect(objects, recurse) {
|
||||
return raycaster.intersectObjects(objects, recurse);
|
||||
// console.log(({int: objects}));
|
||||
let ints = raycaster.intersectObjects(objects, recurse);
|
||||
// console.trace({ints});
|
||||
return ints;
|
||||
}
|
||||
|
||||
/** ******************************************************************
|
||||
|
|
|
|||
Loading…
Reference in a new issue