Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
73fc787a
Commit
73fc787a
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
tweaks to canvas3d.add
parent
c1a3c28c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-canvas3d/canvas3d.ts
+8
-6
8 additions, 6 deletions
src/mol-canvas3d/canvas3d.ts
with
8 additions
and
6 deletions
src/mol-canvas3d/canvas3d.ts
+
8
−
6
View file @
73fc787a
...
@@ -9,9 +9,8 @@ import { now } from 'mol-util/now';
...
@@ -9,9 +9,8 @@ import { now } from 'mol-util/now';
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
import
{
Vec3
}
from
'
mol-math/linear-algebra
'
import
InputObserver
from
'
mol-util/input/input-observer
'
import
InputObserver
from
'
mol-util/input/input-observer
'
import
{
SetUtils
}
from
'
mol-util/set
'
import
Renderer
,
{
RendererStats
}
from
'
mol-gl/renderer
'
import
Renderer
,
{
RendererStats
}
from
'
mol-gl/renderer
'
import
{
RenderObject
}
from
'
mol-gl/render-object
'
import
{
Graphics
RenderObject
}
from
'
mol-gl/render-object
'
import
{
TrackballControls
,
TrackballControlsParams
}
from
'
./controls/trackball
'
import
{
TrackballControls
,
TrackballControlsParams
}
from
'
./controls/trackball
'
import
{
Viewport
}
from
'
./camera/util
'
import
{
Viewport
}
from
'
./camera/util
'
...
@@ -29,6 +28,7 @@ import { Camera } from './camera';
...
@@ -29,6 +28,7 @@ import { Camera } from './camera';
import
{
ParamDefinition
as
PD
}
from
'
mol-util/param-definition
'
;
import
{
ParamDefinition
as
PD
}
from
'
mol-util/param-definition
'
;
import
{
BoundingSphereHelper
,
DebugHelperParams
}
from
'
./helper/bounding-sphere-helper
'
;
import
{
BoundingSphereHelper
,
DebugHelperParams
}
from
'
./helper/bounding-sphere-helper
'
;
import
{
decodeFloatRGB
}
from
'
mol-util/float-packing
'
;
import
{
decodeFloatRGB
}
from
'
mol-util/float-packing
'
;
import
{
SetUtils
}
from
'
mol-util/set
'
;
export
const
Canvas3DParams
=
{
export
const
Canvas3DParams
=
{
// TODO: FPS cap?
// TODO: FPS cap?
...
@@ -83,7 +83,7 @@ namespace Canvas3D {
...
@@ -83,7 +83,7 @@ namespace Canvas3D {
export
function
create
(
canvas
:
HTMLCanvasElement
,
container
:
Element
,
props
:
Partial
<
Canvas3DProps
>
=
{}):
Canvas3D
{
export
function
create
(
canvas
:
HTMLCanvasElement
,
container
:
Element
,
props
:
Partial
<
Canvas3DProps
>
=
{}):
Canvas3D
{
const
p
=
{
...
PD
.
getDefaultValues
(
Canvas3DParams
),
...
props
}
const
p
=
{
...
PD
.
getDefaultValues
(
Canvas3DParams
),
...
props
}
const
reprRenderObjects
=
new
Map
<
Representation
.
Any
,
Set
<
RenderObject
>>
()
const
reprRenderObjects
=
new
Map
<
Representation
.
Any
,
Set
<
Graphics
RenderObject
>>
()
const
reprUpdatedSubscriptions
=
new
Map
<
Representation
.
Any
,
Subscription
>
()
const
reprUpdatedSubscriptions
=
new
Map
<
Representation
.
Any
,
Subscription
>
()
const
reprCount
=
new
BehaviorSubject
(
0
)
const
reprCount
=
new
BehaviorSubject
(
0
)
...
@@ -300,11 +300,13 @@ namespace Canvas3D {
...
@@ -300,11 +300,13 @@ namespace Canvas3D {
function
add
(
repr
:
Representation
.
Any
)
{
function
add
(
repr
:
Representation
.
Any
)
{
isUpdating
=
true
isUpdating
=
true
const
oldRO
=
reprRenderObjects
.
get
(
repr
)
const
oldRO
=
reprRenderObjects
.
get
(
repr
)
const
newRO
=
new
Set
<
RenderObject
>
()
const
newRO
=
new
Set
<
Graphics
RenderObject
>
()
repr
.
renderObjects
.
forEach
(
o
=>
newRO
.
add
(
o
))
repr
.
renderObjects
.
forEach
(
o
=>
newRO
.
add
(
o
))
if
(
oldRO
)
{
if
(
oldRO
)
{
SetUtils
.
difference
(
newRO
,
oldRO
).
forEach
(
o
=>
scene
.
add
(
o
))
if
(
!
SetUtils
.
areEqual
(
newRO
,
oldRO
))
{
SetUtils
.
difference
(
oldRO
,
newRO
).
forEach
(
o
=>
scene
.
remove
(
o
))
for
(
const
o
of
Array
.
from
(
newRO
))
{
if
(
!
oldRO
.
has
(
o
))
scene
.
add
(
o
)
}
for
(
const
o
of
Array
.
from
(
oldRO
))
{
if
(
!
newRO
.
has
(
o
))
scene
.
remove
(
o
)
}
}
}
else
{
}
else
{
repr
.
renderObjects
.
forEach
(
o
=>
scene
.
add
(
o
))
repr
.
renderObjects
.
forEach
(
o
=>
scene
.
add
(
o
))
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment