Skip to content

Commit 8a2d91d

Browse files
committed
Add reset button
1 parent f10f254 commit 8a2d91d

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/controls.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,22 @@ export class URDFControls extends GUI {
252252
);
253253
this._enforceNumericInput(this.controls.joints[name]);
254254
});
255+
256+
// Add reset button
257+
const resetSettings = {
258+
'Reset Joints': () => {
259+
Object.keys(this.controls.joints).forEach((jointName: string) => {
260+
if (jointName !== 'reset' && this.controls.joints[jointName]) {
261+
this.controls.joints[jointName].setValue(0);
262+
}
263+
});
264+
}
265+
};
266+
this.controls.joints.reset = this._jointsFolder.add(
267+
resetSettings,
268+
'Reset Joints'
269+
);
270+
255271
this._jointsFolder.open();
256272
}
257273
return this.controls.joints;

src/layout.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,11 @@ export class URDFLayout extends PanelLayout {
384384
jointNames
385385
);
386386

387+
// Connect the cursor link selection mode
388+
editorControls.mode.onChange((enabled: boolean) => {
389+
this._interactionEditor.setLinkSelectorMode(enabled);
390+
});
391+
387392
// Handle joint selection for modification
388393
editorControls.selectedJoint.onChange((selectedJoint: string) => {
389394
const isModifying = selectedJoint !== 'New Joint';

style/base.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,8 @@ li.cr.number.has-slider > div {
202202
font-family: var(--jp-ui-font-family, sans-serif);
203203
font-size: var(--jp-ui-font-size1, 12px);
204204
}
205+
206+
/* Limit dropdown width to prevent UI overflow */
207+
.urdf-gui .cr select {
208+
max-width: 180px !important;
209+
}

0 commit comments

Comments
 (0)