@@ -128,28 +128,38 @@ def init_webgl(self):
128128 # camera and controls
129129
130130 if self .config .view .viewport == "top" :
131- self .camera3 = three .OrthographicCamera (width / - 2 , width / 2 , height / 2 , height / - 2 , 0.1 , 10000 )
132- self .camera3 .position = self .config .view .camera .position or [0 , 0 , 1 ]
131+ self .camera3 = three .OrthographicCamera (
132+ width / - 2 ,
133+ width / 2 ,
134+ height / 2 ,
135+ height / - 2 ,
136+ self .config .view .camera .near ,
137+ self .config .view .camera .far ,
138+ )
139+ self .camera3 .position = self .config .view .camera .position
133140 self .camera3 .zoom = 1
134141
135142 self .controls3 = three .OrbitControls (controlling = self .camera3 )
136143 self .controls3 .enableRotate = False
137- self .controls3 .maxDistance = 1000
138- self .controls3 .minDistance = 0.1
144+ self .controls3 .maxDistance = self . config . view . camera . far
145+ self .controls3 .minDistance = self . config . view . camera . near
139146
140147 elif self .config .view .viewport == "perspective" :
141148 self .camera3 = three .PerspectiveCamera ()
142- self .camera3 .position = self .config .view .camera .position or [ 0 , - 10 , 5 ]
143- self .camera3 .up = self .config .view .camera .up or [ 0 , 0 , 1 ]
149+ self .camera3 .position = self .config .view .camera .position
150+ self .camera3 .up = self .config .view .camera .up
144151 self .camera3 .aspect = aspect
145- self .camera3 .near = self .config .view .camera .near or 0.1
146- self .camera3 .far = self .config .view .camera .far or 1000
147- self .camera3 .fov = self .config .view .camera .fov or 50
148- self .camera3 .lookAt (self .config .view .camera .target or [0 , 0 , 0 ])
152+ self .camera3 .near = self .config .view .camera .near
153+ self .camera3 .far = self .config .view .camera .far
154+ self .camera3 .fov = self .config .view .camera .fov
149155
150156 self .controls3 = three .OrbitControls (controlling = self .camera3 )
151- self .controls3 .maxDistance = 1000
152- self .controls3 .minDistance = 0.1
157+ self .controls3 .maxDistance = self .config .view .camera .far
158+ self .controls3 .minDistance = self .config .view .camera .near
159+ self .controls3 .target = self .config .view .camera .target
160+
161+ self .camera3 .zoom = 1
162+ self .camera3 .lookAt (self .config .view .camera .target )
153163
154164 else :
155165 raise NotImplementedError
0 commit comments