Skip to content

Commit

Permalink
Add back websocketUrl property.
Browse files Browse the repository at this point in the history
  • Loading branch information
jstnhuang committed Sep 5, 2017
1 parent 2da38f0 commit 1e41f75
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions ros-rviz.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
Example:
<ros-websocket auto ros="{{ros}}"></ros-websocket>
<ros-rviz ros="{{ros}}"></ros-rviz>
<ros-websocket auto ros="{{ros}}" url="{{url}}"></ros-websocket>
<ros-rviz ros="{{ros}}" websocket-url="{{url}}"></ros-rviz>
@demo demo/index.html
-->
Expand Down Expand Up @@ -183,6 +183,11 @@
type: Object,
observer: '_rosChanged',
},
websocketUrl: {
notify: true,
type: String,
observer: '_websocketUrlChanged'
},
tfClient: Object, // The ROSLIB.TFClient
_viewer: Object, // The ROS3D viewer
},
Expand All @@ -192,8 +197,23 @@
observers: [
'_fixedFrameChanged(config.globalOptions.fixedFrame)',
'_backgroundChanged(config.globalOptions.background)',
'_globalWebsocketUrlChanged(config.globalOptions.url)',
],

// The websocketUrl property is intended to be bound to the url property of a
// <ros-websocket> element. We mirror its value to config.globalOptions.url. If the user edits
// the websocket URL, the change eventually propagates to the websocketUrl property through
// the two-way binding we manually add here.

// If the property changes, mirror to config.
_websocketUrlChanged: function(url) {
this.set('config.globalOptions.url', url);
},
// If the config changes, mirror to property.
_globalWebsocketUrlChanged: function(url) {
this.websocketUrl = url;
},

_backgroundChanged: function(background) {
if (background && this._viewer) {
this._viewer.renderer.setClearColor(parseInt(background.replace('#', '0x'), 16), 1);
Expand Down

0 comments on commit 1e41f75

Please sign in to comment.