Commit 63a60e33 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

stopping pt

parent bffabbb2
......@@ -26,6 +26,9 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
this.customHome = json.customHome || function(){};
this.customPickUpStock = json.customPickUpStock || function(){};
this.customPlacePart = json.customPlacePart || function(){};
this.customFunctionsContext = {
clearHeight: 8
};
this.object3D = new THREE.Object3D();
three.sceneAdd(this.object3D);
......@@ -422,6 +425,12 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
this.object3D = null;
};
Assembler.prototype.saveJSON = function(){
return {
}
};
Assembler.prototype.toJSON = function(){
var componentsJSON = {};
_.each(this.components, function(component, id){
......
......@@ -278,6 +278,11 @@ define(['underscore', 'cam', 'three'], function(_, cam, THREE){
};
Component.prototype.saveJSON = function(){
};
Component.prototype.toJSON = function(){
var childIDs = [];
_.each(this.children, function(child){
......
......@@ -14,6 +14,8 @@ require.config({
bootstrapSlider: '../dependencies/bootstrap-slider/bootstrap-slider',
fileSaverLib: '../dependencies/loaders/FileSaver.min',
numeric: '../dependencies/numeric-1.2.6',
codeMirrorJS: '../dependencies/codemirror/javascript',
codeMirror: '../dependencies/codemirror/codemirror',
//three
three: '../dependencies/three',
......@@ -141,6 +143,7 @@ require.config({
navViewMenuTemplate: 'menus/templates/NavViewMenu.html',
ribbonTemplate: 'menus/templates/Ribbon.html',
modalViewTemplate: 'menus/templates/ModalView.html',
scriptView: 'menus/ScriptView',
menuWrapperTemplate: 'menus/templates/MenuWrapperView.html',
latticeMenuTemplate: 'menus/templates/LatticeMenuView.html',
importMenuTemplate: 'menus/templates/ImportMenuView.html',
......@@ -230,6 +233,10 @@ require.config({
},
'numeric': {
exports: 'numeric'
},
'codeMirror': {
deps: ['codeMirrorJS'],
exports: 'CodeMirror'
}
}
......
......@@ -3,7 +3,11 @@
*/
ScriptView = Backbone.View.extend({
define(['jquery', 'underscore', 'backbone', 'appState', 'codeMirror'], function($, _, Backbone, appState, CodeMirror){
var ScriptView = Backbone.View.extend({
el: "#scriptView",
......@@ -18,36 +22,36 @@ ScriptView = Backbone.View.extend({
_.bindAll(this, "render", "_handleKeyStroke");
//bind events
$(document).bind('keydown', {}, this._handleKeyStroke);
// $(document).bind('keydown', {}, this._handleKeyStroke);
this.render();
this.listenTo(globals.appState, "change:scriptIsVisible", this._setVisibility);
this.listenTo(this.model, "change:scriptIsVisible", this._setVisibility);
},
_handleKeyStroke: function(e){
if (e.keyCode == 82 && this.model.get("currentTab") == "script"){
if (e.shiftKey || !e.metaKey) return;
e.preventDefault();
e.stopPropagation();
// globals.appState.runScript(globals.codeMirror.getValue());
}
},
// _handleKeyStroke: function(e){
// if (e.keyCode == 82 && this.model.get("currentTab") == "script"){
// if (e.shiftKey || !e.metaKey) return;
// e.preventDefault();
// e.stopPropagation();
// // appState.runScript(globals.codeMirror.getValue());
// }
// },
_runScript: function(e){
e.preventDefault();
// globals.appState.runScript(globals.codeMirror.getValue());
},
_saveScript: function(e){
e.preventDefault();
// globals.appState.syncScript(globals.codeMirror.getValue());
// globals.saveFile(globals.script, "linkageScript", ".js");
// appState.runScript(globals.codeMirror.getValue());
},
_loadScript: function(e){
e.preventDefault();
$("#fileInput").click();
},
// _saveScript: function(e){
// e.preventDefault();
// // appState.syncScript(globals.codeMirror.getValue());
// // globals.saveFile(globals.script, "linkageScript", ".js");
// },
//
// _loadScript: function(e){
// e.preventDefault();
// $("#fileInput").click();
// },
_setEditorHeight: function(){
var $editor = $('.CodeMirror');
......@@ -71,8 +75,8 @@ ScriptView = Backbone.View.extend({
},
render: function(){
this.$el.html(this.template({script:globals.script}));
globals.codeMirror = CodeMirror.fromTextArea(document.getElementById("scriptEditor"), {
this.$el.html(this.template({script:"test"}));
CodeMirror.fromTextArea(document.getElementById("scriptEditor"), {
lineNumbers: true,
mode: "javascript"
});
......@@ -86,4 +90,9 @@ ScriptView = Backbone.View.extend({
<textarea id="scriptEditor"><%= script %></textarea><br/>\
')
});
return new ScriptView({model: appState});
});
\ No newline at end of file
......@@ -129,7 +129,6 @@ define(['three'], function(THREE){
rapidHeight:30,
rapidHeightRelative: true,
safeHeight: 4.5,
clearHeight: 8,
originPosition: new THREE.Vector3(0,0,0),
rapidSpeeds:{xy: 250, z: 250},
feedRate:{xy: 6, z: 6}
......
Supports Markdown
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