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
5533e7e3
Commit
5533e7e3
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-plugin: snapshot duration
parent
c9a07888
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-plugin/behavior/static/state.ts
+1
-1
1 addition, 1 deletion
src/mol-plugin/behavior/static/state.ts
src/mol-plugin/state.ts
+6
-3
6 additions, 3 deletions
src/mol-plugin/state.ts
src/mol-plugin/state/snapshots.ts
+8
-4
8 additions, 4 deletions
src/mol-plugin/state/snapshots.ts
with
15 additions
and
8 deletions
src/mol-plugin/behavior/static/state.ts
+
1
−
1
View file @
5533e7e3
...
@@ -128,7 +128,7 @@ export function Snapshots(ctx: PluginContext) {
...
@@ -128,7 +128,7 @@ export function Snapshots(ctx: PluginContext) {
});
});
PluginCommands
.
State
.
Snapshots
.
Add
.
subscribe
(
ctx
,
({
name
,
description
,
params
})
=>
{
PluginCommands
.
State
.
Snapshots
.
Add
.
subscribe
(
ctx
,
({
name
,
description
,
params
})
=>
{
const
entry
=
PluginStateSnapshotManager
.
Entry
(
ctx
.
state
.
getSnapshot
(
params
),
name
,
description
);
const
entry
=
PluginStateSnapshotManager
.
Entry
(
ctx
.
state
.
getSnapshot
(
params
),
{
name
,
description
}
);
ctx
.
state
.
snapshots
.
add
(
entry
);
ctx
.
state
.
snapshots
.
add
(
entry
);
});
});
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/state.ts
+
6
−
3
View file @
5533e7e3
...
@@ -56,7 +56,8 @@ class PluginState {
...
@@ -56,7 +56,8 @@ class PluginState {
cameraSnapshots
:
p
.
cameraSnapshots
?
this
.
cameraSnapshots
.
getStateSnapshot
()
:
void
0
,
cameraSnapshots
:
p
.
cameraSnapshots
?
this
.
cameraSnapshots
.
getStateSnapshot
()
:
void
0
,
canvas3d
:
p
.
canvas3d
?
{
canvas3d
:
p
.
canvas3d
?
{
props
:
this
.
plugin
.
canvas3d
.
props
props
:
this
.
plugin
.
canvas3d
.
props
}
:
void
0
}
:
void
0
,
durationInMs
:
params
&&
params
.
durationInMs
};
};
}
}
...
@@ -111,6 +112,7 @@ namespace PluginState {
...
@@ -111,6 +112,7 @@ namespace PluginState {
export
type
CameraTransitionStyle
=
'
instant
'
|
'
animate
'
export
type
CameraTransitionStyle
=
'
instant
'
|
'
animate
'
export
const
GetSnapshotParams
=
{
export
const
GetSnapshotParams
=
{
durationInMs
:
PD
.
Numeric
(
1500
,
{
min
:
100
,
max
:
15000
,
step
:
100
},
{
label
:
'
Duration in MS
'
}),
data
:
PD
.
Boolean
(
true
),
data
:
PD
.
Boolean
(
true
),
behavior
:
PD
.
Boolean
(
false
),
behavior
:
PD
.
Boolean
(
false
),
animation
:
PD
.
Boolean
(
true
),
animation
:
PD
.
Boolean
(
true
),
...
@@ -120,7 +122,7 @@ namespace PluginState {
...
@@ -120,7 +122,7 @@ namespace PluginState {
cameraSnapshots
:
PD
.
Boolean
(
false
),
cameraSnapshots
:
PD
.
Boolean
(
false
),
cameraTranstionStyle
:
PD
.
Select
<
CameraTransitionStyle
>
(
'
animate
'
,
[[
'
animate
'
,
'
Animate
'
],
[
'
instant
'
,
'
Instant
'
]])
cameraTranstionStyle
:
PD
.
Select
<
CameraTransitionStyle
>
(
'
animate
'
,
[[
'
animate
'
,
'
Animate
'
],
[
'
instant
'
,
'
Instant
'
]])
};
};
export
type
GetSnapshotParams
=
Partial
<
PD
.
Value
<
typeof
GetSnapshotParams
>>
export
type
GetSnapshotParams
=
Partial
<
PD
.
Value
s
<
typeof
GetSnapshotParams
>>
export
const
DefaultGetSnapshotParams
=
PD
.
getDefaultValues
(
GetSnapshotParams
);
export
const
DefaultGetSnapshotParams
=
PD
.
getDefaultValues
(
GetSnapshotParams
);
export
interface
Snapshot
{
export
interface
Snapshot
{
...
@@ -135,6 +137,7 @@ namespace PluginState {
...
@@ -135,6 +137,7 @@ namespace PluginState {
cameraSnapshots
?:
CameraSnapshotManager
.
StateSnapshot
,
cameraSnapshots
?:
CameraSnapshotManager
.
StateSnapshot
,
canvas3d
?:
{
canvas3d
?:
{
props
?:
Canvas3DProps
props
?:
Canvas3DProps
}
},
durationInMs
?:
number
}
}
}
}
This diff is collapsed.
Click to expand it.
src/mol-plugin/state/snapshots.ts
+
8
−
4
View file @
5533e7e3
...
@@ -61,7 +61,10 @@ class PluginStateSnapshotManager extends PluginComponent<{
...
@@ -61,7 +61,10 @@ class PluginStateSnapshotManager extends PluginComponent<{
const
idx
=
this
.
getIndex
(
old
);
const
idx
=
this
.
getIndex
(
old
);
// The id changes here!
// The id changes here!
const
e
=
PluginStateSnapshotManager
.
Entry
(
snapshot
,
old
.
name
,
old
.
description
);
const
e
=
PluginStateSnapshotManager
.
Entry
(
snapshot
,
{
name
:
old
.
name
,
description
:
old
.
description
});
this
.
entryMap
.
set
(
snapshot
.
id
,
e
);
this
.
entryMap
.
set
(
snapshot
.
id
,
e
);
this
.
updateState
({
current
:
e
.
snapshot
.
id
,
entries
:
this
.
state
.
entries
.
set
(
idx
,
e
)
});
this
.
updateState
({
current
:
e
.
snapshot
.
id
,
entries
:
this
.
state
.
entries
.
set
(
idx
,
e
)
});
this
.
events
.
changed
.
next
();
this
.
events
.
changed
.
next
();
...
@@ -174,7 +177,8 @@ class PluginStateSnapshotManager extends PluginComponent<{
...
@@ -174,7 +177,8 @@ class PluginStateSnapshotManager extends PluginComponent<{
}
}
const
snapshot
=
this
.
setCurrent
(
next
)
!
;
const
snapshot
=
this
.
setCurrent
(
next
)
!
;
await
this
.
plugin
.
state
.
setSnapshot
(
snapshot
);
await
this
.
plugin
.
state
.
setSnapshot
(
snapshot
);
this
.
timeoutHandle
=
setTimeout
(
this
.
next
,
this
.
state
.
nextSnapshotDelayInMs
);
const
delay
=
typeof
snapshot
.
durationInMs
!==
'
undefined
'
?
snapshot
.
durationInMs
:
this
.
state
.
nextSnapshotDelayInMs
;
this
.
timeoutHandle
=
setTimeout
(
this
.
next
,
delay
);
};
};
play
()
{
play
()
{
...
@@ -213,8 +217,8 @@ namespace PluginStateSnapshotManager {
...
@@ -213,8 +217,8 @@ namespace PluginStateSnapshotManager {
snapshot
:
PluginState
.
Snapshot
snapshot
:
PluginState
.
Snapshot
}
}
export
function
Entry
(
snapshot
:
PluginState
.
Snapshot
,
name
?:
string
,
description
?:
string
):
Entry
{
export
function
Entry
(
snapshot
:
PluginState
.
Snapshot
,
params
:
{
name
?:
string
,
description
?:
string
}
):
Entry
{
return
{
timestamp
:
+
new
Date
(),
name
,
snapshot
,
description
};
return
{
timestamp
:
+
new
Date
(),
snapshot
,
...
params
};
}
}
export
interface
RemoteSnapshot
{
export
interface
RemoteSnapshot
{
...
...
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