From 82d509d79646ce790c41e74a5b2f4a49b80f1785 Mon Sep 17 00:00:00 2001
From: Ugo Albanese <ugo.albanese@santannapisa.it>
Date: Mon, 2 Sep 2019 17:05:30 +0000
Subject: [PATCH] Merged in NUIT-120-clean-gzgui-unused (pull request #28)

[NUIT-120] Clean up gzgui from unused code.

Approved-by: Kepa Cantero <cantero@fortiss.org>
Approved-by: Luc Guyot <luc.guyot@epfl.ch>
---
 gz3d/build/gz3d.js | 743 ++-------------------------------------------
 gz3d/src/gzgui.js  | 740 ++------------------------------------------
 2 files changed, 45 insertions(+), 1438 deletions(-)

diff --git a/gz3d/build/gz3d.js b/gz3d/build/gz3d.js
index a829026..b7df380 100644
--- a/gz3d/build/gz3d.js
+++ b/gz3d/build/gz3d.js
@@ -3162,8 +3162,7 @@ GZ3D.ComposerSettings = function ()
 
 var guiEvents = new EventEmitter2({ verbose: true });
 
-var emUnits = function(value)
-    {
+var emUnits = function(value) {
       return value*parseFloat($('#gz3d-body').css('font-size'));
     };
 
@@ -3183,373 +3182,6 @@ var isTallScreen = function()
     {
       return $(window).height() / emUnits(1) > 35;
     };
-var lastOpenMenu = {mainMenu: 'mainMenu', insertMenu: 'insertMenu',
-    treeMenu: 'treeMenu'};
-
-var tabColors = {selected: 'rgb(34, 170, 221)', unselected: 'rgb(42, 42, 42)'};
-
-$(function()
-{
-  //Initialize
-  if ('ontouchstart' in window || 'onmsgesturechange' in window)
-  {
-    $('#gz3d-body').addClass('isTouchDevice');
-  }
-
-  // Toggle items
-  $('#view-collisions').buttonMarkup({icon: 'false'});
-  $('#snap-to-grid').buttonMarkup({icon: 'false'});
-  $('#open-tree-when-selected').buttonMarkup({icon: 'false'});
-  $('#view-transparent').buttonMarkup({icon: 'false'});
-  $('#view-wireframe').buttonMarkup({icon: 'false'});
-  $('#view-joints').buttonMarkup({icon: 'false'});
-  guiEvents.emit('toggle_notifications');
-  guiEvents.emit('show_orbit_indicator');
-
-  $( '#clock-touch' ).popup('option', 'arrow', 't');
-  $('#notification-popup-screen').remove();
-  $('.tab').css('border-left-color', tabColors.unselected);
-
-  if (isWideScreen())
-  {
-    guiEvents.emit('openTab', 'mainMenu', 'mainMenu');
-  }
-
-  if (isTallScreen())
-  {
-    $('.collapsible_header').click();
-    $('#expand-MODELS').click();
-    $('#expand-LIGHTS').click();
-  }
-
-  // Touch devices
-  if (isTouchDevice)
-  {
-    $('.mouse-only')
-        .css('display','none');
-
-    $('#play-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '13.6em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#clock-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '10.2em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#mode-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '0.5em')
-        .css('top', '0.15em')
-        .css('z-index', '1000');
-
-    $('.gzGUI').touchstart(function(event){
-        guiEvents.emit('pointerOnMenu');
-    });
-
-    $('.gzGUI').touchend(function(event){
-        guiEvents.emit('pointerOffMenu');
-    });
-
-    // long press on canvas
-    var press_time_container = 400;
-    $('#container')
-      .on('touchstart', function (event) {
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_container_start',event);
-        }, press_time_container));
-      })
-      .on('touchend', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_container_end',event,false);
-      })
-      .on('touchmove', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_container_start',event);
-        }, press_time_container));
-        guiEvents.emit('longpress_container_move',event);
-      });
-
-    // long press on insert menu item
-    var press_time_insert = 400;
-    $('[id^="insert-entity-"]')
-      .on('touchstart', function (event) {
-        var path = $(this).attr('id');
-        path = path.substring(14); // after 'insert-entity-'
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_insert_start', event, path);
-        }, press_time_insert));
-      })
-      .on('touchend', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_insert_end',event,false);
-      })
-      .on('touchmove', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_insert_move',event);
-      });
-  }
-  // Mouse devices
-  else
-  {
-    $('.touch-only')
-        .css('display','none');
-
-    $('[id^="insert-entity-"]')
-      .click(function(event) {
-        var path = $(this).attr('id');
-        path = path.substring(14); // after 'insert-entity-'
-        guiEvents.emit('spawn_entity_start', path);
-      })
-      .on('mousedown', function(event) {
-        event.preventDefault();
-      });
-
-    $('#play-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '41.2em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#clock-mouse')
-        .css('position', 'absolute')
-        .css('right', '29.0em')
-        .css('top', '0.5em')
-        .css('z-index', '100')
-        .css('width', '11em')
-        .css('height', '2.5em')
-        .css('background-color', '#333333')
-        .css('padding', '3px')
-        .css('border-radius', '5px');
-
-    $('#mode-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '24.4em')
-        .css('top', '0.15em')
-        .css('z-index', '1000');
-
-    $('#box-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '15.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#sphere-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '12.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#cylinder-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '9.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#pointlight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '6.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#spotlight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '3.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#directionallight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '0.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('.gzGUI').mouseenter(function(event){
-        guiEvents.emit('pointerOnMenu');
-    });
-
-    $('.gzGUI').mouseleave(function(event){
-        guiEvents.emit('pointerOffMenu');
-    });
-
-    // right-click
-    $('#container').mousedown(function(event)
-        {
-          event.preventDefault();
-          if(event.which === 3)
-          {
-            guiEvents.emit('right_click', event);
-          }
-        });
-
-    $('#model-popup-screen').mousedown(function(event)
-        {
-          $('#model-popup').popup('close');
-        });
-  }
-
-  $('.tab').click(function()
-      {
-        var idTab = $(this).attr('id');
-        var idMenu = idTab.substring(0,idTab.indexOf('Tab'));
-
-        if($('#'+idTab).css('border-left-color') === tabColors.unselected)
-        {
-          guiEvents.emit('openTab', lastOpenMenu[idMenu], idMenu);
-        }
-        else
-        {
-          guiEvents.emit('closeTabs', true);
-        }
-      });
-
-  $('.closePanels').click(function()
-      {
-        guiEvents.emit('closeTabs', true);
-      });
-
-  $('#view-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'view');
-      });
-  $('#translate-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'translate');
-      });
-  $('#rotate-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'rotate');
-      });
-
-  $('[id^="header-insert-"]').click(function()
-      {
-        var entity = $(this).attr('id');
-        entity = entity.substring(14); // after 'header-insert-'
-        guiEvents.emit('closeTabs', false);
-        guiEvents.emit('spawn_entity_start', entity);
-      });
-
-  $('#play').click(function()
-      {
-        if ( $('#playText').html().indexOf('Play') !== -1 )
-        {
-          guiEvents.emit('pause', false);
-          guiEvents.emit('notification_popup','Physics engine running');
-        }
-        else
-        {
-          guiEvents.emit('pause', true);
-          guiEvents.emit('notification_popup','Physics engine paused');
-        }
-      });
-  $('#clock').click(function()
-      {
-        if ($.mobile.activePage.find('#clock-touch').parent().
-            hasClass('ui-popup-active'))
-        {
-          $( '#clock-touch' ).popup('close');
-        }
-        else
-        {
-          var position = $('#clock').offset();
-          $('#notification-popup').popup('close');
-          $('#clock-touch').popup('open', {
-              x:position.left+emUnits(1.6),
-              y:emUnits(4)});
-        }
-      });
-
-  $('#reset-model').click(function()
-      {
-        guiEvents.emit('model_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#reset-world').click(function()
-      {
-        guiEvents.emit('world_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#reset-view').click(function()
-      {
-        guiEvents.emit('view_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-grid').click(function()
-      {
-        guiEvents.emit('show_grid', 'toggle');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-collisions').click(function()
-      {
-        guiEvents.emit('show_collision');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-orbit-indicator').click(function()
-      {
-        guiEvents.emit('show_orbit_indicator');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-shadows').click(function()
-      {
-        guiEvents.emit('show_shadows', 'toggle');
-      });
-  $('#view-camera-sensors').click(function()
-      {
-        guiEvents.emit('show_camera_sensors', 'toggle');
-      });
-  $( '#snap-to-grid' ).click(function() {
-    guiEvents.emit('snap_to_grid');
-    guiEvents.emit('closeTabs', false);
-  });
-  $( '#open-tree-when-selected' ).click(function() {
-    guiEvents.emit('openTreeWhenSelected');
-    guiEvents.emit('closeTabs', false);
-  });
-  $( '#toggle-notifications' ).click(function() {
-    guiEvents.emit('toggle_notifications');
-    guiEvents.emit('closeTabs', false);
-  });
-
-  // Disable Esc key to close panel
-    $('#gz3d-body').on('keyup', function(event) {
-    if (event.which === 27)
-    {
-      return false;
-    }
-  });
-
-  // Object menu
-  $( '#view-transparent' ).click(function() {
-    $('#model-popup').popup('close');
-    guiEvents.emit('set_view_as','transparent');
-  });
-
-  $( '#view-wireframe' ).click(function() {
-    $('#model-popup').popup('close');
-    guiEvents.emit('set_view_as','wireframe');
-  });
-
-  $( '#view-joints' ).click(function() {
-    if ($('#view-joints a').css('color') === 'rgb(255, 255, 255)')
-    {
-      $('#model-popup').popup('close');
-      guiEvents.emit('view_joints');
-    }
-  });
-
-  $( '#delete-entity' ).click(function() {
-    guiEvents.emit('delete_entity');
-  });
-
-  $(window).resize(function()
-  {
-    guiEvents.emit('resizePanel');
-  });
-});
 
 function getNameFromPath(path)
 {
@@ -3628,14 +3260,11 @@ gzangular.controller('treeControl', ['$scope', function($scope)
 
   $scope.selectEntity = function (name)
   {
-    $('#model-popup').popup('close');
-    guiEvents.emit('openTab', 'propertyPanel-'+name, 'treeMenu');
     guiEvents.emit('selectEntity', name);
   };
 
   $scope.openEntityMenu = function (event, name)
   {
-    $('#model-popup').popup('close');
     guiEvents.emit('openEntityPopup', event, name);
   };
 
@@ -3644,72 +3273,6 @@ gzangular.controller('treeControl', ['$scope', function($scope)
     guiEvents.emit('openTab', tab, 'treeMenu');
   };
 
-  $scope.expandTree = function (tree)
-  {
-    var idContent = 'expandable-' + tree;
-    var idHeader = 'expand-' + tree;
-
-    if ($('#' + idContent).is(':visible'))
-    {
-      $('#' + idContent).hide();
-      $('#' + idHeader+' img').css('transform','rotate(0deg)')
-                              .css('-webkit-transform','rotate(0deg)')
-                              .css('-ms-transform','rotate(0deg)');
-    }
-    else
-    {
-      $('#' + idContent).show();
-      $('#' + idHeader+' img').css('transform','rotate(90deg)')
-                              .css('-webkit-transform','rotate(90deg)')
-                              .css('-ms-transform','rotate(90deg)');
-    }
-  };
-
-  $scope.expandProperty = function (prop, modelName, subPropShortName, subPropName, parentProp)
-  {
-    var idContent = 'expandable-' + prop + '-' + modelName;
-    var idHeader = 'expand-' + prop + '-' + modelName;
-
-    var idContentOthers, idHeaderOthers;
-
-    if (subPropShortName)
-    {
-      idContentOthers = idContent;
-      idHeaderOthers = idHeader;
-      idContent = idContent + '-' + subPropShortName;
-      idHeader = idHeader + '-' + subPropShortName;
-    }
-
-    if ($('#' + idContent).is(':visible'))
-    {
-      $('#' + idContent).hide();
-      $('#' + idHeader+' img').css('transform','rotate(0deg)')
-                              .css('-webkit-transform','rotate(0deg)')
-                              .css('-ms-transform','rotate(0deg)');
-    }
-    else
-    {
-      if (subPropShortName && (prop === 'link' || prop === 'joint'))
-      {
-        $('[id^="' + idContentOthers + '-"]').hide();
-        $('[id^="' + idHeaderOthers + '-"] img')
-            .css('transform','rotate(0deg)')
-            .css('-webkit-transform','rotate(0deg)')
-            .css('-ms-transform','rotate(0deg)');
-      }
-
-      $('#' + idContent).show();
-      $('#' + idHeader+' img').css('transform','rotate(90deg)')
-                              .css('-webkit-transform','rotate(90deg)')
-                              .css('-ms-transform','rotate(90deg)');
-
-      if (prop === 'pose' && parentProp === 'link')
-      {
-        guiEvents.emit('setPoseStats', modelName, subPropName);
-      }
-    }
-  };
-
   $scope.changePose = function(prop1, prop2, name, value)
   {
     guiEvents.emit('setPose', prop1, prop2, name, value);
@@ -3796,8 +3359,6 @@ GZ3D.Gui.prototype.init = function()
       {
         // manually trigger view mode
         that.scene.setManipulationMode('view');
-        $('#view-mode').prop('checked', true);
-        $('input[type="radio"]').checkboxradio('refresh');
 
         var name = getNameFromPath(modelPath);
 
@@ -3850,73 +3411,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('show_shadows', function(option)
-      {
-          if (option === 'show')
-          {
-              //that.emitter.emit('setShadows', true);
-              that.scene.setShadowMaps(true);
-          }
-          else if (option === 'hide')
-          {
-              //that.emitter.emit('setShadows', false);
-              that.scene.setShadowMaps(false);
-          }
-          else if (option === 'toggle')
-          {
-              var shadowsEnabled = that.scene.renderer.shadowMap.enabled;
-              //that.emitter.emit('setShadows', !shadowsEnabled);
-              that.scene.setShadowMaps(!shadowsEnabled);
-          }
-
-          if(!that.scene.renderer.shadowMap.enabled)
-          {
-              $('#view-shadows').buttonMarkup({icon: 'false'});
-              guiEvents.emit('notification_popup','Disabling shadows');
-          }
-          else
-          {
-              $('#view-shadows').buttonMarkup({icon: 'check'});
-              guiEvents.emit('notification_popup','Enabling shadows');
-          }
-      }
-  );
-
-    guiEvents.on('show_camera_sensors', function(option)
-        {
-            var camerasShown = false;
-            if (option === 'show')
-            {
-                that.scene.viewManager.showCameras(true);
-            }
-            else if (option === 'hide')
-            {
-                that.scene.viewManager.showCameras(false);
-            }
-            else if (option === 'toggle')
-            {
-                if (that.scene.viewManager.views.length > 1) {
-                    camerasShown = that.scene.viewManager.views[1].active;
-                    that.scene.viewManager.showCameras(!camerasShown);
-                }
-            }
-
-            if (that.scene.viewManager.views.length > 1) {
-                camerasShown = that.scene.viewManager.views[1].active;
-            }
-            if(!camerasShown)
-            {
-                $('#view-camera-sensors').buttonMarkup({icon: 'false'});
-                guiEvents.emit('notification_popup','Disabling camera views');
-            }
-            else
-            {
-                $('#view-camera-sensors').buttonMarkup({icon: 'check'});
-                guiEvents.emit('notification_popup','Enabling camera views');
-            }
-        }
-    );
-
   guiEvents.on('pause', function(paused)
       {
         that.emitter.emit('pause', paused);
@@ -3928,12 +3422,10 @@ GZ3D.Gui.prototype.init = function()
         that.scene.showCollision(!that.scene.showCollisions);
         if(!that.scene.showCollisions)
         {
-          $('#view-collisions').buttonMarkup({icon: 'false'});
           guiEvents.emit('notification_popup','Hiding collisions');
         }
         else
         {
-          $('#view-collisions').buttonMarkup({icon: 'check'});
           guiEvents.emit('notification_popup','Viewing collisions');
         }
       }
@@ -3956,12 +3448,10 @@ GZ3D.Gui.prototype.init = function()
 
         if(!that.scene.grid.visible)
         {
-          $('#view-grid').buttonMarkup({icon: 'false'});
           guiEvents.emit('notification_popup','Hiding grid');
         }
         else
         {
-          $('#view-grid').buttonMarkup({icon: 'check'});
           guiEvents.emit('notification_popup','Viewing grid');
         }
       }
@@ -3978,14 +3468,12 @@ GZ3D.Gui.prototype.init = function()
       {
         if(that.scene.modelManipulator.snapDist === null)
         {
-          $('#snap-to-grid').buttonMarkup({icon: 'check'});
           that.scene.modelManipulator.snapDist = 0.5;
           that.scene.spawnModel.snapDist = that.scene.modelManipulator.snapDist;
           guiEvents.emit('notification_popup','Snapping to grid');
         }
         else
         {
-          $('#snap-to-grid').buttonMarkup({icon: 'false'});
           that.scene.modelManipulator.snapDist = null;
           that.scene.spawnModel.snapDist = null;
           guiEvents.emit('notification_popup','Not snapping to grid');
@@ -3993,35 +3481,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('openTreeWhenSelected', function ()
-      {
-        this.openTreeWhenSelected = !this.openTreeWhenSelected;
-        if(!this.openTreeWhenSelected)
-        {
-          $('#open-tree-when-selected').buttonMarkup({icon: 'false'});
-        }
-        else
-        {
-          $('#open-tree-when-selected').buttonMarkup({icon: 'check'});
-        }
-      }
-  );
-
-  guiEvents.on('toggle_notifications', function ()
-      {
-        this.showNotifications = !this.showNotifications;
-        if(!this.showNotifications)
-        {
-          $('#toggle-notifications').buttonMarkup({icon: 'false'});
-        }
-        else
-        {
-          $('#toggle-notifications').buttonMarkup({icon: 'check'});
-        }
-      }
-  );
-
-
   guiEvents.on('longpress_container_start',
       function (event)
       {
@@ -4061,19 +3520,13 @@ GZ3D.Gui.prototype.init = function()
                 {
                   that.emitter.emit('deleteEntity',entity);
                   that.scene.setManipulationMode('view');
-                  $( '#view-mode' ).prop('checked', true);
-                  $('input[type="radio"]').checkboxradio('refresh');
                 }
                 else if (type === 'translate')
                 {
-                  $('#translate-mode').click();
-                  $('input[type="radio"]').checkboxradio('refresh');
                   that.scene.attachManipulator(entity,type);
                 }
                 else if (type === 'rotate')
                 {
-                  $( '#rotate-mode' ).click();
-                  $('input[type="radio"]').checkboxradio('refresh');
                   that.scene.attachManipulator(entity,type);
                 }
                 else if (type === 'transparent')
@@ -4193,7 +3646,6 @@ GZ3D.Gui.prototype.init = function()
   guiEvents.on('delete_entity', function ()
       {
         that.emitter.emit('deleteEntity',that.scene.selectedEntity);
-        $('#model-popup').popup('close');
         that.scene.selectEntity(null);
         that.scene.manipulationMode = 'view';
       }
@@ -4209,8 +3661,6 @@ GZ3D.Gui.prototype.init = function()
           {
             // manually trigger view mode
             that.scene.setManipulationMode('view');
-            $('#view-mode').prop('checked', true);
-            $('input[type="radio"]').checkboxradio('refresh');
 
             var name = getNameFromPath(entity);
 
@@ -4240,102 +3690,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('openTab', function (id, parentId)
-      {
-        lastOpenMenu[parentId] = id;
-
-        $('.leftPanels').hide();
-        //$('#'+id).show(); //defaults as flex, but block is needed
-        $('#'+id).css('display','block');
-
-        $('.tab').css('border-left-color', tabColors.unselected);
-        $('#'+parentId+'Tab').css('border-left-color', tabColors.selected);
-
-        if (id.indexOf('propertyPanel-') >= 0)
-        {
-          var entityName = id.substring(id.indexOf('-')+1);
-          var object = that.scene.getByName(entityName);
-
-          var stats = {};
-          stats.name = entityName;
-
-          stats.pose = {};
-          stats.pose.position = {x: object.position.x,
-                                 y: object.position.y,
-                                 z: object.position.z};
-
-          stats.pose.orientation = {x: object.quaternion._x,
-                                    y: object.quaternion._y,
-                                    z: object.quaternion._z,
-                                    w: object.quaternion._w};
-        }
-
-        guiEvents.emit('resizePanel');
-      }
-  );
-
-  guiEvents.on('closeTabs', function (force)
-      {
-        // Close for narrow viewports, force to always close
-        if (force || !isWideScreen())
-        {
-          $('.leftPanels').hide();
-          $('.tab').css('left', '0em');
-          $('.tab').css('border-left-color', tabColors.unselected);
-        }
-      }
-  );
-
-  guiEvents.on('setTreeSelected', function (object)
-      {
-        for (var i = 0; i < modelStats.length; ++i)
-        {
-          if (modelStats[i].name === object)
-          {
-            modelStats[i].selected = 'selectedTreeItem';
-            if (this.openTreeWhenSelected)
-            {
-              guiEvents.emit('openTab', 'propertyPanel-'+object, 'treeMenu');
-            }
-          }
-          else
-          {
-            modelStats[i].selected = 'unselectedTreeItem';
-          }
-        }
-        for (i = 0; i < lightStats.length; ++i)
-        {
-          if (lightStats[i].name === object)
-          {
-            lightStats[i].selected = 'selectedTreeItem';
-            if (this.openTreeWhenSelected)
-            {
-              guiEvents.emit('openTab', 'propertyPanel-'+object, 'treeMenu');
-            }
-          }
-          else
-          {
-            lightStats[i].selected = 'unselectedTreeItem';
-          }
-        }
-        that.updateStats();
-      }
-  );
-
-  guiEvents.on('setTreeDeselected', function ()
-      {
-        for (var i = 0; i < modelStats.length; ++i)
-        {
-          modelStats[i].selected = 'unselectedTreeItem';
-        }
-        for (i = 0; i < lightStats.length; ++i)
-        {
-          lightStats[i].selected = 'unselectedTreeItem';
-        }
-        that.updateStats();
-      }
-  );
-
   guiEvents.on('selectEntity', function (name)
       {
         var object = that.scene.getByName(name);
@@ -4499,43 +3853,6 @@ GZ3D.Gui.prototype.init = function()
   );
 };
 
-/**
- * Play/pause simulation
- * @param {boolean} paused
- */
-GZ3D.Gui.prototype.setPaused = function(paused)
-{
-  if (paused)
-  {
-    $('#playText').html(
-        '<img style="height:1.2em" src="style/images/play.png" title="Play">');
-  }
-  else
-  {
-    $('#playText').html(
-        '<img style="height:1.2em" src="style/images/pause.png" title="Pause">'
-        );
-  }
-};
-
-/**
- * Update displayed real time
- * @param {string} realTime
- */
-GZ3D.Gui.prototype.setRealTime = function(realTime)
-{
-  $('.real-time-value').text(realTime);
-};
-
-/**
- * Update displayed simulation time
- * @param {string} simTime
- */
-GZ3D.Gui.prototype.setSimTime = function(simTime)
-{
-  $('.sim-time-value').text(simTime);
-};
-
 var sceneStats = {};
 /**
  * Update scene stats on scene tree
@@ -4732,40 +4049,31 @@ GZ3D.Gui.prototype.setModelStats = function(stats, action)
         }
       }
 
-      // Update pose stats only if they're being displayed and are not focused
-      if (!((linkShortName &&
-          !$('#expandable-pose-'+modelName+'-'+linkShortName).is(':visible'))||
-          (!linkShortName &&
-          !$('#expandable-pose-'+modelName).is(':visible'))||
-          $('#expandable-pose-'+modelName+' input').is(':focus')))
+      if (stats.position)
+      {
+        stats.pose = {};
+        stats.pose.position = stats.position;
+        stats.pose.orientation = stats.orientation;
+      }
+
+      if (stats.pose)
       {
+        formatted = this.formatStats(stats);
 
-        if (stats.position)
+        if (linkShortName === undefined)
         {
-          stats.pose = {};
-          stats.pose.position = stats.position;
-          stats.pose.orientation = stats.orientation;
+          model[0].position = formatted.pose.position;
+          model[0].orientation = formatted.pose.orientation;
         }
-
-        if (stats.pose)
+        else
         {
-          formatted = this.formatStats(stats);
-
-          if (linkShortName === undefined)
-          {
-            model[0].position = formatted.pose.position;
-            model[0].orientation = formatted.pose.orientation;
-          }
-          else
-          {
-            link = $.grep(model[0].links, function(e)
-              {
-                return e.shortName === linkShortName;
-              });
+          link = $.grep(model[0].links, function(e)
+            {
+              return e.shortName === linkShortName;
+            });
 
-            link[0].position = formatted.pose.position;
-            link[0].orientation = formatted.pose.orientation;
-          }
+          link[0].position = formatted.pose.position;
+          link[0].orientation = formatted.pose.orientation;
         }
       }
     }
@@ -4989,6 +4297,7 @@ GZ3D.Gui.prototype.updateStats = function()
  * @param {} event
  * @param {THREE.Object3D} entity
  */
+/* Unused, left for future reference
 GZ3D.Gui.prototype.openEntityPopup = function(event, entity)
 {
   this.scene.selectEntity(entity);
@@ -5049,7 +4358,7 @@ GZ3D.Gui.prototype.openEntityPopup = function(event, entity)
        y: event.offsetY + emUnits(0)});
   }
 };
-
+*/
 /**
  * Format stats message for proper display
  * @param {} stats
@@ -5249,11 +4558,6 @@ GZ3D.Gui.prototype.deleteFromStats = function(type, name)
   {
     if (list[i].name === name)
     {
-      if ($('#propertyPanel-'+name).is(':visible'))
-      {
-        guiEvents.emit('openTab', 'treeMenu', 'treeMenu');
-      }
-
       list.splice(i, 1);
       break;
     }
@@ -14250,8 +13554,7 @@ GZ3D.SpawnModel.prototype.start = function (modelPath, modelSDF, modelName, call
   }
   else
   {
-    if (typeof modelSDF === 'undefined') modelSDF = 'model.sdf';
-    mesh = this.sdfParser.loadSDF(modelPath + '/' + modelSDF);
+    mesh = this.sdfParser.loadSDF(modelSDF);
     //TODO: add transparency to the object
     zoffset = 0;
     this.autoAlignModel.alignOnMeshBase();
diff --git a/gz3d/src/gzgui.js b/gz3d/src/gzgui.js
index 69fbcbe..1d298d5 100644
--- a/gz3d/src/gzgui.js
+++ b/gz3d/src/gzgui.js
@@ -3,8 +3,7 @@
 
 var guiEvents = new EventEmitter2({ verbose: true });
 
-var emUnits = function(value)
-    {
+var emUnits = function(value) {
       return value*parseFloat($('#gz3d-body').css('font-size'));
     };
 
@@ -24,373 +23,6 @@ var isTallScreen = function()
     {
       return $(window).height() / emUnits(1) > 35;
     };
-var lastOpenMenu = {mainMenu: 'mainMenu', insertMenu: 'insertMenu',
-    treeMenu: 'treeMenu'};
-
-var tabColors = {selected: 'rgb(34, 170, 221)', unselected: 'rgb(42, 42, 42)'};
-
-$(function()
-{
-  //Initialize
-  if ('ontouchstart' in window || 'onmsgesturechange' in window)
-  {
-    $('#gz3d-body').addClass('isTouchDevice');
-  }
-
-  // Toggle items
-  $('#view-collisions').buttonMarkup({icon: 'false'});
-  $('#snap-to-grid').buttonMarkup({icon: 'false'});
-  $('#open-tree-when-selected').buttonMarkup({icon: 'false'});
-  $('#view-transparent').buttonMarkup({icon: 'false'});
-  $('#view-wireframe').buttonMarkup({icon: 'false'});
-  $('#view-joints').buttonMarkup({icon: 'false'});
-  guiEvents.emit('toggle_notifications');
-  guiEvents.emit('show_orbit_indicator');
-
-  $( '#clock-touch' ).popup('option', 'arrow', 't');
-  $('#notification-popup-screen').remove();
-  $('.tab').css('border-left-color', tabColors.unselected);
-
-  if (isWideScreen())
-  {
-    guiEvents.emit('openTab', 'mainMenu', 'mainMenu');
-  }
-
-  if (isTallScreen())
-  {
-    $('.collapsible_header').click();
-    $('#expand-MODELS').click();
-    $('#expand-LIGHTS').click();
-  }
-
-  // Touch devices
-  if (isTouchDevice)
-  {
-    $('.mouse-only')
-        .css('display','none');
-
-    $('#play-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '13.6em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#clock-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '10.2em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#mode-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '0.5em')
-        .css('top', '0.15em')
-        .css('z-index', '1000');
-
-    $('.gzGUI').touchstart(function(event){
-        guiEvents.emit('pointerOnMenu');
-    });
-
-    $('.gzGUI').touchend(function(event){
-        guiEvents.emit('pointerOffMenu');
-    });
-
-    // long press on canvas
-    var press_time_container = 400;
-    $('#container')
-      .on('touchstart', function (event) {
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_container_start',event);
-        }, press_time_container));
-      })
-      .on('touchend', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_container_end',event,false);
-      })
-      .on('touchmove', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_container_start',event);
-        }, press_time_container));
-        guiEvents.emit('longpress_container_move',event);
-      });
-
-    // long press on insert menu item
-    var press_time_insert = 400;
-    $('[id^="insert-entity-"]')
-      .on('touchstart', function (event) {
-        var path = $(this).attr('id');
-        path = path.substring(14); // after 'insert-entity-'
-        $(this).data('checkdown', setTimeout(function () {
-          guiEvents.emit('longpress_insert_start', event, path);
-        }, press_time_insert));
-      })
-      .on('touchend', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_insert_end',event,false);
-      })
-      .on('touchmove', function (event) {
-        clearTimeout($(this).data('checkdown'));
-        guiEvents.emit('longpress_insert_move',event);
-      });
-  }
-  // Mouse devices
-  else
-  {
-    $('.touch-only')
-        .css('display','none');
-
-    $('[id^="insert-entity-"]')
-      .click(function(event) {
-        var path = $(this).attr('id');
-        path = path.substring(14); // after 'insert-entity-'
-        guiEvents.emit('spawn_entity_start', path);
-      })
-      .on('mousedown', function(event) {
-        event.preventDefault();
-      });
-
-    $('#play-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '41.2em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#clock-mouse')
-        .css('position', 'absolute')
-        .css('right', '29.0em')
-        .css('top', '0.5em')
-        .css('z-index', '100')
-        .css('width', '11em')
-        .css('height', '2.5em')
-        .css('background-color', '#333333')
-        .css('padding', '3px')
-        .css('border-radius', '5px');
-
-    $('#mode-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '24.4em')
-        .css('top', '0.15em')
-        .css('z-index', '1000');
-
-    $('#box-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '15.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#sphere-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '12.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#cylinder-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '9.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#pointlight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '6.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#spotlight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '3.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('#directionallight-header-fieldset')
-        .css('position', 'absolute')
-        .css('right', '0.5em')
-        .css('top', '0em')
-        .css('z-index', '1000');
-
-    $('.gzGUI').mouseenter(function(event){
-        guiEvents.emit('pointerOnMenu');
-    });
-
-    $('.gzGUI').mouseleave(function(event){
-        guiEvents.emit('pointerOffMenu');
-    });
-
-    // right-click
-    $('#container').mousedown(function(event)
-        {
-          event.preventDefault();
-          if(event.which === 3)
-          {
-            guiEvents.emit('right_click', event);
-          }
-        });
-
-    $('#model-popup-screen').mousedown(function(event)
-        {
-          $('#model-popup').popup('close');
-        });
-  }
-
-  $('.tab').click(function()
-      {
-        var idTab = $(this).attr('id');
-        var idMenu = idTab.substring(0,idTab.indexOf('Tab'));
-
-        if($('#'+idTab).css('border-left-color') === tabColors.unselected)
-        {
-          guiEvents.emit('openTab', lastOpenMenu[idMenu], idMenu);
-        }
-        else
-        {
-          guiEvents.emit('closeTabs', true);
-        }
-      });
-
-  $('.closePanels').click(function()
-      {
-        guiEvents.emit('closeTabs', true);
-      });
-
-  $('#view-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'view');
-      });
-  $('#translate-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'translate');
-      });
-  $('#rotate-mode').click(function()
-      {
-        guiEvents.emit('manipulation_mode', 'rotate');
-      });
-
-  $('[id^="header-insert-"]').click(function()
-      {
-        var entity = $(this).attr('id');
-        entity = entity.substring(14); // after 'header-insert-'
-        guiEvents.emit('closeTabs', false);
-        guiEvents.emit('spawn_entity_start', entity);
-      });
-
-  $('#play').click(function()
-      {
-        if ( $('#playText').html().indexOf('Play') !== -1 )
-        {
-          guiEvents.emit('pause', false);
-          guiEvents.emit('notification_popup','Physics engine running');
-        }
-        else
-        {
-          guiEvents.emit('pause', true);
-          guiEvents.emit('notification_popup','Physics engine paused');
-        }
-      });
-  $('#clock').click(function()
-      {
-        if ($.mobile.activePage.find('#clock-touch').parent().
-            hasClass('ui-popup-active'))
-        {
-          $( '#clock-touch' ).popup('close');
-        }
-        else
-        {
-          var position = $('#clock').offset();
-          $('#notification-popup').popup('close');
-          $('#clock-touch').popup('open', {
-              x:position.left+emUnits(1.6),
-              y:emUnits(4)});
-        }
-      });
-
-  $('#reset-model').click(function()
-      {
-        guiEvents.emit('model_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#reset-world').click(function()
-      {
-        guiEvents.emit('world_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#reset-view').click(function()
-      {
-        guiEvents.emit('view_reset');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-grid').click(function()
-      {
-        guiEvents.emit('show_grid', 'toggle');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-collisions').click(function()
-      {
-        guiEvents.emit('show_collision');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-orbit-indicator').click(function()
-      {
-        guiEvents.emit('show_orbit_indicator');
-        guiEvents.emit('closeTabs', false);
-      });
-  $('#view-shadows').click(function()
-      {
-        guiEvents.emit('show_shadows', 'toggle');
-      });
-  $('#view-camera-sensors').click(function()
-      {
-        guiEvents.emit('show_camera_sensors', 'toggle');
-      });
-  $( '#snap-to-grid' ).click(function() {
-    guiEvents.emit('snap_to_grid');
-    guiEvents.emit('closeTabs', false);
-  });
-  $( '#open-tree-when-selected' ).click(function() {
-    guiEvents.emit('openTreeWhenSelected');
-    guiEvents.emit('closeTabs', false);
-  });
-  $( '#toggle-notifications' ).click(function() {
-    guiEvents.emit('toggle_notifications');
-    guiEvents.emit('closeTabs', false);
-  });
-
-  // Disable Esc key to close panel
-    $('#gz3d-body').on('keyup', function(event) {
-    if (event.which === 27)
-    {
-      return false;
-    }
-  });
-
-  // Object menu
-  $( '#view-transparent' ).click(function() {
-    $('#model-popup').popup('close');
-    guiEvents.emit('set_view_as','transparent');
-  });
-
-  $( '#view-wireframe' ).click(function() {
-    $('#model-popup').popup('close');
-    guiEvents.emit('set_view_as','wireframe');
-  });
-
-  $( '#view-joints' ).click(function() {
-    if ($('#view-joints a').css('color') === 'rgb(255, 255, 255)')
-    {
-      $('#model-popup').popup('close');
-      guiEvents.emit('view_joints');
-    }
-  });
-
-  $( '#delete-entity' ).click(function() {
-    guiEvents.emit('delete_entity');
-  });
-
-  $(window).resize(function()
-  {
-    guiEvents.emit('resizePanel');
-  });
-});
 
 function getNameFromPath(path)
 {
@@ -469,14 +101,11 @@ gzangular.controller('treeControl', ['$scope', function($scope)
 
   $scope.selectEntity = function (name)
   {
-    $('#model-popup').popup('close');
-    guiEvents.emit('openTab', 'propertyPanel-'+name, 'treeMenu');
     guiEvents.emit('selectEntity', name);
   };
 
   $scope.openEntityMenu = function (event, name)
   {
-    $('#model-popup').popup('close');
     guiEvents.emit('openEntityPopup', event, name);
   };
 
@@ -485,72 +114,6 @@ gzangular.controller('treeControl', ['$scope', function($scope)
     guiEvents.emit('openTab', tab, 'treeMenu');
   };
 
-  $scope.expandTree = function (tree)
-  {
-    var idContent = 'expandable-' + tree;
-    var idHeader = 'expand-' + tree;
-
-    if ($('#' + idContent).is(':visible'))
-    {
-      $('#' + idContent).hide();
-      $('#' + idHeader+' img').css('transform','rotate(0deg)')
-                              .css('-webkit-transform','rotate(0deg)')
-                              .css('-ms-transform','rotate(0deg)');
-    }
-    else
-    {
-      $('#' + idContent).show();
-      $('#' + idHeader+' img').css('transform','rotate(90deg)')
-                              .css('-webkit-transform','rotate(90deg)')
-                              .css('-ms-transform','rotate(90deg)');
-    }
-  };
-
-  $scope.expandProperty = function (prop, modelName, subPropShortName, subPropName, parentProp)
-  {
-    var idContent = 'expandable-' + prop + '-' + modelName;
-    var idHeader = 'expand-' + prop + '-' + modelName;
-
-    var idContentOthers, idHeaderOthers;
-
-    if (subPropShortName)
-    {
-      idContentOthers = idContent;
-      idHeaderOthers = idHeader;
-      idContent = idContent + '-' + subPropShortName;
-      idHeader = idHeader + '-' + subPropShortName;
-    }
-
-    if ($('#' + idContent).is(':visible'))
-    {
-      $('#' + idContent).hide();
-      $('#' + idHeader+' img').css('transform','rotate(0deg)')
-                              .css('-webkit-transform','rotate(0deg)')
-                              .css('-ms-transform','rotate(0deg)');
-    }
-    else
-    {
-      if (subPropShortName && (prop === 'link' || prop === 'joint'))
-      {
-        $('[id^="' + idContentOthers + '-"]').hide();
-        $('[id^="' + idHeaderOthers + '-"] img')
-            .css('transform','rotate(0deg)')
-            .css('-webkit-transform','rotate(0deg)')
-            .css('-ms-transform','rotate(0deg)');
-      }
-
-      $('#' + idContent).show();
-      $('#' + idHeader+' img').css('transform','rotate(90deg)')
-                              .css('-webkit-transform','rotate(90deg)')
-                              .css('-ms-transform','rotate(90deg)');
-
-      if (prop === 'pose' && parentProp === 'link')
-      {
-        guiEvents.emit('setPoseStats', modelName, subPropName);
-      }
-    }
-  };
-
   $scope.changePose = function(prop1, prop2, name, value)
   {
     guiEvents.emit('setPose', prop1, prop2, name, value);
@@ -637,8 +200,6 @@ GZ3D.Gui.prototype.init = function()
       {
         // manually trigger view mode
         that.scene.setManipulationMode('view');
-        $('#view-mode').prop('checked', true);
-        $('input[type="radio"]').checkboxradio('refresh');
 
         var name = getNameFromPath(modelPath);
 
@@ -691,73 +252,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('show_shadows', function(option)
-      {
-          if (option === 'show')
-          {
-              //that.emitter.emit('setShadows', true);
-              that.scene.setShadowMaps(true);
-          }
-          else if (option === 'hide')
-          {
-              //that.emitter.emit('setShadows', false);
-              that.scene.setShadowMaps(false);
-          }
-          else if (option === 'toggle')
-          {
-              var shadowsEnabled = that.scene.renderer.shadowMap.enabled;
-              //that.emitter.emit('setShadows', !shadowsEnabled);
-              that.scene.setShadowMaps(!shadowsEnabled);
-          }
-
-          if(!that.scene.renderer.shadowMap.enabled)
-          {
-              $('#view-shadows').buttonMarkup({icon: 'false'});
-              guiEvents.emit('notification_popup','Disabling shadows');
-          }
-          else
-          {
-              $('#view-shadows').buttonMarkup({icon: 'check'});
-              guiEvents.emit('notification_popup','Enabling shadows');
-          }
-      }
-  );
-
-    guiEvents.on('show_camera_sensors', function(option)
-        {
-            var camerasShown = false;
-            if (option === 'show')
-            {
-                that.scene.viewManager.showCameras(true);
-            }
-            else if (option === 'hide')
-            {
-                that.scene.viewManager.showCameras(false);
-            }
-            else if (option === 'toggle')
-            {
-                if (that.scene.viewManager.views.length > 1) {
-                    camerasShown = that.scene.viewManager.views[1].active;
-                    that.scene.viewManager.showCameras(!camerasShown);
-                }
-            }
-
-            if (that.scene.viewManager.views.length > 1) {
-                camerasShown = that.scene.viewManager.views[1].active;
-            }
-            if(!camerasShown)
-            {
-                $('#view-camera-sensors').buttonMarkup({icon: 'false'});
-                guiEvents.emit('notification_popup','Disabling camera views');
-            }
-            else
-            {
-                $('#view-camera-sensors').buttonMarkup({icon: 'check'});
-                guiEvents.emit('notification_popup','Enabling camera views');
-            }
-        }
-    );
-
   guiEvents.on('pause', function(paused)
       {
         that.emitter.emit('pause', paused);
@@ -769,12 +263,10 @@ GZ3D.Gui.prototype.init = function()
         that.scene.showCollision(!that.scene.showCollisions);
         if(!that.scene.showCollisions)
         {
-          $('#view-collisions').buttonMarkup({icon: 'false'});
           guiEvents.emit('notification_popup','Hiding collisions');
         }
         else
         {
-          $('#view-collisions').buttonMarkup({icon: 'check'});
           guiEvents.emit('notification_popup','Viewing collisions');
         }
       }
@@ -797,12 +289,10 @@ GZ3D.Gui.prototype.init = function()
 
         if(!that.scene.grid.visible)
         {
-          $('#view-grid').buttonMarkup({icon: 'false'});
           guiEvents.emit('notification_popup','Hiding grid');
         }
         else
         {
-          $('#view-grid').buttonMarkup({icon: 'check'});
           guiEvents.emit('notification_popup','Viewing grid');
         }
       }
@@ -819,14 +309,12 @@ GZ3D.Gui.prototype.init = function()
       {
         if(that.scene.modelManipulator.snapDist === null)
         {
-          $('#snap-to-grid').buttonMarkup({icon: 'check'});
           that.scene.modelManipulator.snapDist = 0.5;
           that.scene.spawnModel.snapDist = that.scene.modelManipulator.snapDist;
           guiEvents.emit('notification_popup','Snapping to grid');
         }
         else
         {
-          $('#snap-to-grid').buttonMarkup({icon: 'false'});
           that.scene.modelManipulator.snapDist = null;
           that.scene.spawnModel.snapDist = null;
           guiEvents.emit('notification_popup','Not snapping to grid');
@@ -834,35 +322,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('openTreeWhenSelected', function ()
-      {
-        this.openTreeWhenSelected = !this.openTreeWhenSelected;
-        if(!this.openTreeWhenSelected)
-        {
-          $('#open-tree-when-selected').buttonMarkup({icon: 'false'});
-        }
-        else
-        {
-          $('#open-tree-when-selected').buttonMarkup({icon: 'check'});
-        }
-      }
-  );
-
-  guiEvents.on('toggle_notifications', function ()
-      {
-        this.showNotifications = !this.showNotifications;
-        if(!this.showNotifications)
-        {
-          $('#toggle-notifications').buttonMarkup({icon: 'false'});
-        }
-        else
-        {
-          $('#toggle-notifications').buttonMarkup({icon: 'check'});
-        }
-      }
-  );
-
-
   guiEvents.on('longpress_container_start',
       function (event)
       {
@@ -902,19 +361,13 @@ GZ3D.Gui.prototype.init = function()
                 {
                   that.emitter.emit('deleteEntity',entity);
                   that.scene.setManipulationMode('view');
-                  $( '#view-mode' ).prop('checked', true);
-                  $('input[type="radio"]').checkboxradio('refresh');
                 }
                 else if (type === 'translate')
                 {
-                  $('#translate-mode').click();
-                  $('input[type="radio"]').checkboxradio('refresh');
                   that.scene.attachManipulator(entity,type);
                 }
                 else if (type === 'rotate')
                 {
-                  $( '#rotate-mode' ).click();
-                  $('input[type="radio"]').checkboxradio('refresh');
                   that.scene.attachManipulator(entity,type);
                 }
                 else if (type === 'transparent')
@@ -1034,7 +487,6 @@ GZ3D.Gui.prototype.init = function()
   guiEvents.on('delete_entity', function ()
       {
         that.emitter.emit('deleteEntity',that.scene.selectedEntity);
-        $('#model-popup').popup('close');
         that.scene.selectEntity(null);
         that.scene.manipulationMode = 'view';
       }
@@ -1050,8 +502,6 @@ GZ3D.Gui.prototype.init = function()
           {
             // manually trigger view mode
             that.scene.setManipulationMode('view');
-            $('#view-mode').prop('checked', true);
-            $('input[type="radio"]').checkboxradio('refresh');
 
             var name = getNameFromPath(entity);
 
@@ -1081,102 +531,6 @@ GZ3D.Gui.prototype.init = function()
       }
   );
 
-  guiEvents.on('openTab', function (id, parentId)
-      {
-        lastOpenMenu[parentId] = id;
-
-        $('.leftPanels').hide();
-        //$('#'+id).show(); //defaults as flex, but block is needed
-        $('#'+id).css('display','block');
-
-        $('.tab').css('border-left-color', tabColors.unselected);
-        $('#'+parentId+'Tab').css('border-left-color', tabColors.selected);
-
-        if (id.indexOf('propertyPanel-') >= 0)
-        {
-          var entityName = id.substring(id.indexOf('-')+1);
-          var object = that.scene.getByName(entityName);
-
-          var stats = {};
-          stats.name = entityName;
-
-          stats.pose = {};
-          stats.pose.position = {x: object.position.x,
-                                 y: object.position.y,
-                                 z: object.position.z};
-
-          stats.pose.orientation = {x: object.quaternion._x,
-                                    y: object.quaternion._y,
-                                    z: object.quaternion._z,
-                                    w: object.quaternion._w};
-        }
-
-        guiEvents.emit('resizePanel');
-      }
-  );
-
-  guiEvents.on('closeTabs', function (force)
-      {
-        // Close for narrow viewports, force to always close
-        if (force || !isWideScreen())
-        {
-          $('.leftPanels').hide();
-          $('.tab').css('left', '0em');
-          $('.tab').css('border-left-color', tabColors.unselected);
-        }
-      }
-  );
-
-  guiEvents.on('setTreeSelected', function (object)
-      {
-        for (var i = 0; i < modelStats.length; ++i)
-        {
-          if (modelStats[i].name === object)
-          {
-            modelStats[i].selected = 'selectedTreeItem';
-            if (this.openTreeWhenSelected)
-            {
-              guiEvents.emit('openTab', 'propertyPanel-'+object, 'treeMenu');
-            }
-          }
-          else
-          {
-            modelStats[i].selected = 'unselectedTreeItem';
-          }
-        }
-        for (i = 0; i < lightStats.length; ++i)
-        {
-          if (lightStats[i].name === object)
-          {
-            lightStats[i].selected = 'selectedTreeItem';
-            if (this.openTreeWhenSelected)
-            {
-              guiEvents.emit('openTab', 'propertyPanel-'+object, 'treeMenu');
-            }
-          }
-          else
-          {
-            lightStats[i].selected = 'unselectedTreeItem';
-          }
-        }
-        that.updateStats();
-      }
-  );
-
-  guiEvents.on('setTreeDeselected', function ()
-      {
-        for (var i = 0; i < modelStats.length; ++i)
-        {
-          modelStats[i].selected = 'unselectedTreeItem';
-        }
-        for (i = 0; i < lightStats.length; ++i)
-        {
-          lightStats[i].selected = 'unselectedTreeItem';
-        }
-        that.updateStats();
-      }
-  );
-
   guiEvents.on('selectEntity', function (name)
       {
         var object = that.scene.getByName(name);
@@ -1340,43 +694,6 @@ GZ3D.Gui.prototype.init = function()
   );
 };
 
-/**
- * Play/pause simulation
- * @param {boolean} paused
- */
-GZ3D.Gui.prototype.setPaused = function(paused)
-{
-  if (paused)
-  {
-    $('#playText').html(
-        '<img style="height:1.2em" src="style/images/play.png" title="Play">');
-  }
-  else
-  {
-    $('#playText').html(
-        '<img style="height:1.2em" src="style/images/pause.png" title="Pause">'
-        );
-  }
-};
-
-/**
- * Update displayed real time
- * @param {string} realTime
- */
-GZ3D.Gui.prototype.setRealTime = function(realTime)
-{
-  $('.real-time-value').text(realTime);
-};
-
-/**
- * Update displayed simulation time
- * @param {string} simTime
- */
-GZ3D.Gui.prototype.setSimTime = function(simTime)
-{
-  $('.sim-time-value').text(simTime);
-};
-
 var sceneStats = {};
 /**
  * Update scene stats on scene tree
@@ -1573,40 +890,31 @@ GZ3D.Gui.prototype.setModelStats = function(stats, action)
         }
       }
 
-      // Update pose stats only if they're being displayed and are not focused
-      if (!((linkShortName &&
-          !$('#expandable-pose-'+modelName+'-'+linkShortName).is(':visible'))||
-          (!linkShortName &&
-          !$('#expandable-pose-'+modelName).is(':visible'))||
-          $('#expandable-pose-'+modelName+' input').is(':focus')))
+      if (stats.position)
       {
+        stats.pose = {};
+        stats.pose.position = stats.position;
+        stats.pose.orientation = stats.orientation;
+      }
 
-        if (stats.position)
+      if (stats.pose)
+      {
+        formatted = this.formatStats(stats);
+
+        if (linkShortName === undefined)
         {
-          stats.pose = {};
-          stats.pose.position = stats.position;
-          stats.pose.orientation = stats.orientation;
+          model[0].position = formatted.pose.position;
+          model[0].orientation = formatted.pose.orientation;
         }
-
-        if (stats.pose)
+        else
         {
-          formatted = this.formatStats(stats);
-
-          if (linkShortName === undefined)
-          {
-            model[0].position = formatted.pose.position;
-            model[0].orientation = formatted.pose.orientation;
-          }
-          else
-          {
-            link = $.grep(model[0].links, function(e)
-              {
-                return e.shortName === linkShortName;
-              });
+          link = $.grep(model[0].links, function(e)
+            {
+              return e.shortName === linkShortName;
+            });
 
-            link[0].position = formatted.pose.position;
-            link[0].orientation = formatted.pose.orientation;
-          }
+          link[0].position = formatted.pose.position;
+          link[0].orientation = formatted.pose.orientation;
         }
       }
     }
@@ -1830,6 +1138,7 @@ GZ3D.Gui.prototype.updateStats = function()
  * @param {} event
  * @param {THREE.Object3D} entity
  */
+/* Unused, left for future reference
 GZ3D.Gui.prototype.openEntityPopup = function(event, entity)
 {
   this.scene.selectEntity(entity);
@@ -1890,7 +1199,7 @@ GZ3D.Gui.prototype.openEntityPopup = function(event, entity)
        y: event.offsetY + emUnits(0)});
   }
 };
-
+*/
 /**
  * Format stats message for proper display
  * @param {} stats
@@ -2090,11 +1399,6 @@ GZ3D.Gui.prototype.deleteFromStats = function(type, name)
   {
     if (list[i].name === name)
     {
-      if ($('#propertyPanel-'+name).is(':visible'))
-      {
-        guiEvents.emit('openTab', 'treeMenu', 'treeMenu');
-      }
-
       list.splice(i, 1);
       break;
     }
-- 
GitLab