add look at select face button to tool bar

This commit is contained in:
Val Erastov (xibyte) 2020-05-14 23:15:59 -07:00
parent 71d171898b
commit f0b2de74ed
3 changed files with 12 additions and 4 deletions

View file

@ -1,5 +1,6 @@
import {AXIS, ORIGIN} from '../../math/l3space';
import Vector from 'math/vector';
import {RiCamera2Line} from "react-icons/ri";
const NEG_X = AXIS.X.negate();
const NEG_Y = AXIS.Y.negate();
@ -63,6 +64,12 @@ export default [
},
{
id: 'LookAtFace',
appearance: {
icon: RiCamera2Line,
info: 'move camera to show selected face',
label: 'Look at'
},
invoke: ctx => {
let face = ctx.services.selection.face.single;
if (face) {

View file

@ -7,6 +7,7 @@ import {ActionButtonBehavior} from '../../actions/ActionButtonBehavior';
import capitalize from 'gems/capitalize';
import {combine} from 'lstream';
import {useStream} from "../../../../../modules/ui/effects";
import {NoIcon} from "../../../sketcher/icons/NoIcon";
function ConfigurableToolbar({actions, size, ...props}) {
return <Toolbar size={size} {...props}>
@ -53,10 +54,8 @@ function ActionButton({label, icon, icon96, icon32, cssIcons, symbol, size, noLa
}
}
if (!icon) {
icon = <span>{symbol||(label&&label.charAt(0))}</span>;
if (!icon) {
icon = '?';
}
const txtStub = symbol||(label&&label.charAt(0));
icon = txtStub ? <span>{txtStub}</span> : <NoIcon />;
}
return <ToolbarButton disabled={!enabled} {...props}>

View file

@ -52,6 +52,8 @@ export const SKETCHER_MODE_HEADS_UP_ACTIONS = [
'-',
constraintGlobalActions.map(a => toSketcherActionId(a.id)),
'-',
['LookAtFace'],
'-',
['sketchOpenInTab']
];