Commit 57a926af authored by Andrey Filippov's avatar Andrey Filippov

Merge branch 'master' of https://github.com/Elphel/freecad_x3d

parents 8ea0e3b8 b683b8f9
/* /** @licstart The following is the entire license notice for the
FILE NAME : viewmodel.js * JavaScript code in this page.
DESCRIPTION: x3d viewer *
REVISION: 1.00 * Copyright (C) 2017 Elphel Inc.
AUTHOR: Oleg Dzhimiev <oleg@elphel.com> * Author: Oleg Dzhimiev <oleg@elphel.com>
LICENSE: AGPL v3+, see http://www.gnu.org/licenses/agpl.txt * Desctiption: x3d viewer
Copyright (C) 2015 Elphel, Inc. *
*/ * The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*/
var model = "Undefined"; var model = "Undefined";
var NSN = "m"; var NSN = "m";
...@@ -24,8 +40,13 @@ var zoom = 0.9; ...@@ -24,8 +40,13 @@ var zoom = 0.9;
var undo = Array(); var undo = Array();
$(function(){
prerun();
resize();
});
function resize(){ function resize(){
console.log("resize"); //console.log("resize");
var w = $(window).width(); var w = $(window).width();
var h = $(window).height(); var h = $(window).height();
if (w>h){ if (w>h){
...@@ -109,7 +130,8 @@ function prerun(){ ...@@ -109,7 +130,8 @@ function prerun(){
//load x3dom.js //load x3dom.js
//$.getScript("x3dom-1.7.0/x3dom.debug.js",function(){ //$.getScript("x3dom-1.7.0/x3dom.debug.js",function(){
//$.getScript("http://x3dom.org/download/1.7.1/x3dom.js"); //$.getScript("http://x3dom.org/download/1.7.1/x3dom.js");
$.getScript("http://x3dom.org/download/1.7/x3dom.js",function(){ //$.getScript("http://x3dom.org/download/1.7/x3dom.js",function(){
$.getScript("x3dom-1.7.0/x3dom-full.debug.js",function(){
x3dom.runtime.ready = function() { x3dom.runtime.ready = function() {
//x3dom.caps.BACKEND //x3dom.caps.BACKEND
if (x3dom.caps.BACKEND!="webgl"){ if (x3dom.caps.BACKEND!="webgl"){
...@@ -175,8 +197,8 @@ X3DOM Flash version is not available.<br/>\ ...@@ -175,8 +197,8 @@ X3DOM Flash version is not available.<br/>\
element.runtime.showAll("negY"); element.runtime.showAll("negY");
if (showdefault) element.runtime.resetView(); if (showdefault) element.runtime.resetView();
showall=0; showall=0;
place_camera(); //place_camera();
model_init(); //model_init();
}else{ }else{
//console.log("Loaded "+load_counter); //console.log("Loaded "+load_counter);
if (showall>=0){ if (showall>=0){
...@@ -557,7 +579,7 @@ function showBOM(){ ...@@ -557,7 +579,7 @@ function showBOM(){
}else{ }else{
bomtr_subcounter++; bomtr_subcounter++;
bomtr = $("#bomtr_"+bomtr_subcounter); bomtr = $("#bomtr_"+bomtr_subcounter);
console.log("Adding to tr #"+bomtr_subcounter); //console.log("Adding to tr #"+bomtr_subcounter);
if (bomtr_subcounter==bomtr_counter){ if (bomtr_subcounter==bomtr_counter){
bomtr_subcounter=0; bomtr_subcounter=0;
} }
...@@ -732,6 +754,9 @@ function mousemoved(event){ ...@@ -732,6 +754,9 @@ function mousemoved(event){
function mouseended(event){ function mouseended(event){
dragging = false; dragging = false;
var last_state=getMoveState(event); var last_state=getMoveState(event);
if (move_history != undefined){
console.log("mouse ended, history length="+move_history.length); console.log("mouse ended, history length="+move_history.length);
// find history snapshot farher than minimal or local best or first // find history snapshot farher than minimal or local best or first
var last_dist=0; var last_dist=0;
...@@ -790,6 +815,9 @@ function mouseended(event){ ...@@ -790,6 +815,9 @@ function mouseended(event){
console.log("rotation axis:"+inertial_rot_axis_speed[0].toString()+", angular_velocity="+(1000*inertial_rot_axis_speed[1])+" rad/s"); console.log("rotation axis:"+inertial_rot_axis_speed[0].toString()+", angular_velocity="+(1000*inertial_rot_axis_speed[1])+" rad/s");
inertial_rotate(); inertial_rotate();
}
} }
var animation_array; var animation_array;
......
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