Skip to content

Commit

Permalink
Merge pull request #981 from vorth/used-orbits
Browse files Browse the repository at this point in the history
Implemented online "used in model" orbits option
  • Loading branch information
vorth authored Feb 1, 2025
2 parents f66aff3 + 8e4e76c commit f01fbb2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion online/src/app/classic/components/strutbuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useSymmetry } from "../context/symmetry.jsx";

export const StrutBuildPanel = () =>
{
const { controllerAction } = useEditor();
const { controllerAction, rootController } = useEditor();
const { showOrbitsDialog, symmetryController, symmetryDefined } = useSymmetry();
const availableOrbits = () => subController( symmetryController(), 'availableOrbits' );
const buildOrbits = () => subController( symmetryController(), 'buildOrbits' );
Expand All @@ -32,6 +32,10 @@ export const StrutBuildPanel = () =>
setAnchorEl( null );
setOrbitNames( action );
}
const setUsedOrbits = () => {
setAnchorEl( null );
controllerAction( rootController(), 'usedOrbits' );
}
const showConfiguration = evt => {
setAnchorEl( null );
showOrbitsDialog();
Expand Down Expand Up @@ -59,6 +63,7 @@ export const StrutBuildPanel = () =>
>
<MenuItem onClick={ setAvailableOrbits( 'rZomeOrbits' ) }>real Zome</MenuItem>
<MenuItem onClick={ setAvailableOrbits( 'predefinedOrbits' ) }>predefined</MenuItem>
<MenuItem onClick={ setUsedOrbits }>used in model</MenuItem>
<MenuItem onClick={ setAvailableOrbits( 'setAllDirections' ) }>all</MenuItem>
<MenuItem onClick={ showConfiguration }>configure...</MenuItem>
<MenuItem onClick={ resetOrbitColors }>reset orbit colors</MenuItem>
Expand Down
21 changes: 21 additions & 0 deletions online/src/worker/legacy/controllers/editor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { com } from '../core-java.js';
import { java } from '../candies/j4ts-2.1.0-SNAPSHOT/bundle.js';
import { JsProperties } from '../jsweet2js.js';
import { PickingController } from './picking.js';
import { BuildPlaneController } from './buildplane.js';
Expand Down Expand Up @@ -194,6 +195,26 @@ export class EditorController extends com.vzome.desktop.controller.DefaultContro
break;
}

case "usedOrbits": {
const { renderedModel } = this.legacyDesign;
const usedOrbits = new java.util.HashSet();
const rMans = renderedModel .iterator();
while ( rMans .hasNext() ) {
const rm = rMans .next();
const shape = rm .getShape();
const orbit = shape .getOrbit();
if ( orbit != null )
usedOrbits .add( orbit );
}
this.symmController .availableController .doAction( "setNoDirections" );
const orbits = usedOrbits .iterator();
while ( orbits .hasNext() ) {
const orbit = orbits .next();
this.symmController .availableController .doAction( "enableDirection." + orbit .getName() );
}
break;
}

case "setBuildOrbitAndLength": {
const { picked } = params.getConfig();
const rm = picked .getRenderedObject();
Expand Down

0 comments on commit f01fbb2

Please sign in to comment.