File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ var RenderableView = widgets.DOMWidgetView.extend({
54
54
55
55
this . lazyRendererSetup ( ) ;
56
56
57
+ this . setupEventListeners ( ) ;
58
+ } ,
59
+
60
+ setupEventListeners : function ( ) {
57
61
this . on ( 'destroy' , this . destroy , this ) ;
58
62
this . listenTo ( this . model , 'rerender' , this . tick . bind ( this ) ) ;
59
63
this . listenTo ( this . model , 'msg:custom' , this . onCustomMessage . bind ( this ) ) ;
Original file line number Diff line number Diff line change @@ -67,6 +67,18 @@ var RendererModel = RenderableModel.extend({
67
67
var RendererView = RenderableView . extend ( {
68
68
69
69
lazyRendererSetup : function ( ) {
70
+ this . updateOwn ( ) ;
71
+ this . updateSize ( ) ;
72
+ this . renderScene ( ) ;
73
+ } ,
74
+
75
+ setupEventListeners : function ( ) {
76
+ RenderableView . prototype . setupEventListeners . call ( this ) ;
77
+
78
+ this . listenTo ( this . model , 'change' , this . updateOwn . bind ( this ) ) ;
79
+ } ,
80
+
81
+ updateOwn : function ( ) {
70
82
this . camera = this . model . get ( 'camera' ) . obj ;
71
83
this . scene = this . model . get ( 'scene' ) . obj ;
72
84
controls = [ ] ;
@@ -76,16 +88,17 @@ var RendererView = RenderableView.extend({
76
88
this . controls = controls ;
77
89
this . enableControls ( ) ;
78
90
//this.effect = this.model.get('effect').obj;
79
- this . updateSize ( ) ;
80
- this . renderScene ( ) ;
81
- } ,
82
-
83
- acquireRenderer : function ( ) {
84
- RenderableView . prototype . acquireRenderer . call ( this ) ;
85
91
86
92
var background = ThreeModel . prototype . convertColorModelToThree ( this . model . get ( 'background' ) ) ;
87
93
var background_opacity = ThreeModel . prototype . convertFloatModelToThree ( this . model . get ( 'background_opacity' ) ) ;
88
94
this . renderer . setClearColor ( background , background_opacity ) ;
95
+ } ,
96
+
97
+ acquireRenderer : function ( ) {
98
+ RenderableView . prototype . acquireRenderer . call ( this ) ;
99
+ // We need to ensure that renderer properties are applied
100
+ // (we have no idea where the renderer has been...)
101
+ this . updateOwn ( ) ;
89
102
}
90
103
91
104
} ) ;
You can’t perform that action at this time.
0 commit comments