Commit fd515c66 authored by legoc's avatar legoc
Browse files

Init trajectory settings with clientSettings

parent cda0df65
......@@ -7,11 +7,12 @@ const { synchronize, synchronizeSpy, synchronizeScan } = require('../main/synchr
const THREE = require('three');
class TrajectoryController extends Controller {
constructor(trajectoryPanel, trajectory3D) {
constructor(trajectoryPanel, trajectory3D, trajectorySettings) {
super();
this._trajectoryPanel = trajectoryPanel;
this._trajectory3D = trajectory3D;
this._trajectorySettings = trajectorySettings;
this.init();
......@@ -43,6 +44,12 @@ class TrajectoryController extends Controller {
}
init() {
this._trajectorySettings.setInputs({
energyScale: clientSettings.energyScale,
dataSphereRadius: clientSettings.dataSphereRadius,
maxIntensity: clientSettings.maxIntensity
});
this._trajectoryPanel.clearTrajectories();
this._trajectory3D.clearTrajectories();
......
......@@ -34,8 +34,7 @@ class TrajectorySettingsPanelView {
init() {
// Energy scale. Init with 1.
$('#energyScale').val(1);
// Energy scale.
$("#energyScale").keypress((event) => {
if (event.which == 13 || event.keyCode == 13) {
......@@ -50,8 +49,7 @@ class TrajectorySettingsPanelView {
PubSub.publish('update-trajectory-settings', this.getInputs());
});
// Data sphere radius. Init with 5.
$('#dataSphereRadius').val(5);
// Data sphere radius.
$("#dataSphereRadius").keypress((event) => {
if (event.which == 13 || event.keyCode == 13) {
......@@ -61,13 +59,12 @@ class TrajectorySettingsPanelView {
$('#dataSphereRadiusRange').on('input', () => {
let value = 1 + parseFloat($("#dataSphereRadiusRange").val()) / 100;
$('#dataSphereRadius').val(value);
$('#dataSphereRadius').val(value.toFixed(2));
PubSub.publish('update-trajectory-settings', this.getInputs());
});
// Intensity. Init with 500.
$('#maxIntensity').val(500);
// Intensity.
$("#maxIntensity").keypress((event) => {
if (event.which == 13 || event.keyCode == 13) {
......@@ -86,9 +83,12 @@ class TrajectorySettingsPanelView {
render() {
}
/**
* Get grid inputs and store them into an object.
*/
setInputs(value) {
$('#energyScale').val(value.energyScale);
$('#dataSphereRadius').val(value.dataSphereRadius.toFixed(2));
$('#maxIntensity').val(value.maxIntensity);
}
getInputs() {
return {
energyScale: parseFloat($("#energyScale").val()),
......
......@@ -210,7 +210,7 @@ class ReciprocalView3D {
this._latticeController = new LatticeController(lattice3D);
this._peaksController = new PeaksController(this._peaksPanel);
this._scatteringController = new ScatteringController(this._scatteringPanel, this._anglesPanel, scattering3D);
this._trajectoryController = new TrajectoryController(this._trajectoryPanel, trajectory3D);
this._trajectoryController = new TrajectoryController(this._trajectoryPanel, trajectory3D, this._trajectorySettingsPanel);
this._unitcellController = new UnitCellController(this._atomsPanel);
// The sample controller is initialised after the unit cell because in case of a new client
// with the server having already a space group configured from a previous session, the atoms must be initialised before the space group.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment