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
0081dcb4
Commit
0081dcb4
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-canvas3d: fixed viewport freezing
parent
a445e4c5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-canvas3d/canvas3d.ts
+4
-4
4 additions, 4 deletions
src/mol-canvas3d/canvas3d.ts
src/mol-plugin/ui/viewport.tsx
+5
-8
5 additions, 8 deletions
src/mol-plugin/ui/viewport.tsx
with
9 additions
and
12 deletions
src/mol-canvas3d/canvas3d.ts
+
4
−
4
View file @
0081dcb4
...
@@ -248,7 +248,7 @@ namespace Canvas3D {
...
@@ -248,7 +248,7 @@ namespace Canvas3D {
}
}
async
function
identify
(
x
:
number
,
y
:
number
):
Promise
<
PickingId
|
undefined
>
{
async
function
identify
(
x
:
number
,
y
:
number
):
Promise
<
PickingId
|
undefined
>
{
if
(
pickDirty
||
isPicking
)
return
undefined
if
(
pickDirty
||
isPicking
)
return
;
isPicking
=
true
isPicking
=
true
...
@@ -265,19 +265,19 @@ namespace Canvas3D {
...
@@ -265,19 +265,19 @@ namespace Canvas3D {
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
const
objectId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
const
objectId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
if
(
objectId
===
-
1
)
return
if
(
objectId
===
-
1
)
{
isPicking
=
false
;
return
;
}
instancePickTarget
.
bind
()
instancePickTarget
.
bind
()
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
const
instanceId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
const
instanceId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
if
(
instanceId
===
-
1
)
return
if
(
instanceId
===
-
1
)
{
isPicking
=
false
;
return
;
}
groupPickTarget
.
bind
()
groupPickTarget
.
bind
()
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
// await webgl.readPixelsAsync(xp, yp, 1, 1, buffer)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
webgl
.
readPixels
(
xp
,
yp
,
1
,
1
,
buffer
)
const
groupId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
const
groupId
=
decodeIdRGB
(
buffer
[
0
],
buffer
[
1
],
buffer
[
2
])
if
(
groupId
===
-
1
)
return
if
(
groupId
===
-
1
)
{
isPicking
=
false
;
return
;
}
isPicking
=
false
isPicking
=
false
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/ui/viewport.tsx
+
5
−
8
View file @
0081dcb4
...
@@ -67,8 +67,8 @@ export class ViewportControls extends PluginComponent {
...
@@ -67,8 +67,8 @@ export class ViewportControls extends PluginComponent {
}
}
export
class
Viewport
extends
PluginComponent
<
{
},
ViewportState
>
{
export
class
Viewport
extends
PluginComponent
<
{
},
ViewportState
>
{
private
container
:
HTMLDivElement
|
null
=
null
;
private
container
=
React
.
createRef
<
HTMLDivElement
>
()
;
private
canvas
:
HTMLCanvasElement
|
null
=
null
;
private
canvas
=
React
.
createRef
<
HTMLCanvasElement
>
()
;
state
:
ViewportState
=
{
state
:
ViewportState
=
{
noWebGl
:
false
noWebGl
:
false
...
@@ -79,7 +79,7 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
...
@@ -79,7 +79,7 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
}
}
componentDidMount
()
{
componentDidMount
()
{
if
(
!
this
.
canvas
||
!
this
.
container
||
!
this
.
plugin
.
initViewer
(
this
.
canvas
,
this
.
container
))
{
if
(
!
this
.
canvas
.
current
||
!
this
.
container
.
current
||
!
this
.
plugin
.
initViewer
(
this
.
canvas
.
current
!
,
this
.
container
.
current
!
))
{
this
.
setState
({
noWebGl
:
true
});
this
.
setState
({
noWebGl
:
true
});
}
}
this
.
handleResize
();
this
.
handleResize
();
...
@@ -123,11 +123,8 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
...
@@ -123,11 +123,8 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
if
(
this
.
state
.
noWebGl
)
return
this
.
renderMissing
();
if
(
this
.
state
.
noWebGl
)
return
this
.
renderMissing
();
return
<
div
className
=
'msp-viewport'
>
return
<
div
className
=
'msp-viewport'
>
<
div
className
=
'msp-viewport-host3d'
ref
=
{
elm
=>
this
.
container
=
elm
}
>
<
div
className
=
'msp-viewport-host3d'
ref
=
{
this
.
container
}
>
<
canvas
ref
=
{
elm
=>
{
<
canvas
ref
=
{
this
.
canvas
}
/>
if
(
!!
this
.
canvas
&&
this
.
canvas
!==
elm
)
console
.
warn
(
'
changed viewport canvas
'
)
this
.
canvas
=
elm
}
}
/>
</
div
>
</
div
>
</
div
>;
</
div
>;
}
}
...
...
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