Skip to content

Commit

Permalink
wip: bind dofunc
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Jan 16, 2025
1 parent 57b870f commit 01cc463
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions dist/components/ThreeDEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ class ThreeDEditor extends _react.default.Component {
this.handleStartGifRecording = this.handleStartGifRecording.bind(this);
this.handleMessage = this.handleMessage.bind(this);
this.doWaveFunc = this.doWaveFunc.bind(this);
this.handleSetCameraToFitCell = this.handleSetCameraToFitCell.bind(this);
}
componentDidMount() {
this.addHotKeyListener();
Expand Down Expand Up @@ -790,8 +791,14 @@ class ThreeDEditor extends _react.default.Component {
enableColorScheme: true
}, this.renderWaveOrThreejsEditorModal()));
}
doWaveFunc(func, ...args) {
this.WaveComponent.wave[func](...args);
handleSetCameraToFitCell() {
alert("Setting camera to fit cell"); // eslint-disable-line no-alert
this.WaveComponent.wave.adjustCamerasAndOrbitControlsToCell();
}
doWaveFunc(func_str) {
alert("Executing function: " + func_str); // eslint-disable-line no-alert
const func = eval(func_str); // eslint-disable-line no-eval
this.WaveComponent.wave.doFunc(func);
}
}
exports.ThreeDEditor = ThreeDEditor;
Expand Down
1 change: 1 addition & 0 deletions dist/wave.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class WaveBase {
this.setupLights();
this.handleResize = this.handleResize.bind(this);
this.setBackground = this.setBackground.bind(this);
this.doFunc = this.doFunc.bind(this);
}
updateSettings(settings) {
this.settings = {
Expand Down
12 changes: 10 additions & 2 deletions src/components/ThreeDEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export class ThreeDEditor extends React.Component {
this.handleStartGifRecording = this.handleStartGifRecording.bind(this);
this.handleMessage = this.handleMessage.bind(this);
this.doWaveFunc = this.doWaveFunc.bind(this);
this.handleSetCameraToFitCell = this.handleSetCameraToFitCell.bind(this);
}

componentDidMount() {
Expand Down Expand Up @@ -784,8 +785,15 @@ export class ThreeDEditor extends React.Component {
}
};

doWaveFunc(func, ...args) {
this.WaveComponent.wave[func](...args);
handleSetCameraToFitCell() {
alert("Setting camera to fit cell"); // eslint-disable-line no-alert
this.WaveComponent.wave.adjustCamerasAndOrbitControlsToCell();
}

doWaveFunc(func_str) {
alert("Executing function: " + func_str); // eslint-disable-line no-alert
const func = eval(func_str); // eslint-disable-line no-eval
this.WaveComponent.wave.doFunc(func);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/wave.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class WaveBase {

this.handleResize = this.handleResize.bind(this);
this.setBackground = this.setBackground.bind(this);
this.doFunc = this.doFunc.bind(this);
}

updateSettings(settings) {
Expand Down

0 comments on commit 01cc463

Please sign in to comment.