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
e4f630db
Commit
e4f630db
authored
3 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
improve drag and drop support
- any file type - multiple files - if session, only first is loaded
parent
ccaf18af
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
CHANGELOG.md
+4
-1
4 additions, 1 deletion
CHANGELOG.md
src/mol-plugin-ui/plugin.tsx
+22
-8
22 additions, 8 deletions
src/mol-plugin-ui/plugin.tsx
with
26 additions
and
9 deletions
CHANGELOG.md
+
4
−
1
View file @
e4f630db
...
@@ -7,8 +7,11 @@ Note that since we don't clearly distinguish between a public and private interf
...
@@ -7,8 +7,11 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased]
## [Unreleased]
-
Add
``bumpiness``
(per-object and per-group),
``bumpFrequency``
&
``bumpAmplitude``
(per-object) render parameters (#299)
-
Add
``bumpiness``
(per-object and per-group),
``bumpFrequency``
&
``bumpAmplitude``
(per-object) render parameters (#299)
-
Change
``label``
representation defaults: Use text border instead of rectangle background
.
-
Change
``label``
representation defaults: Use text border instead of rectangle background
-
Add outline color option to renderer
-
Add outline color option to renderer
-
Fix false positives in Model.isFromPdbArchive
-
Add drag and drop support for loading any file, including multiple at once
-
If there are session files (.molx or .molj) among the dropped files, only the first session will be loaded
## [v3.0.0-dev.3] - 2021-12-4
## [v3.0.0-dev.3] - 2021-12-4
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin-ui/plugin.tsx
+
22
−
8
View file @
e4f630db
...
@@ -18,6 +18,8 @@ import { Toasts } from './toast';
...
@@ -18,6 +18,8 @@ import { Toasts } from './toast';
import
{
Viewport
,
ViewportControls
}
from
'
./viewport
'
;
import
{
Viewport
,
ViewportControls
}
from
'
./viewport
'
;
import
{
PluginCommands
}
from
'
../mol-plugin/commands
'
;
import
{
PluginCommands
}
from
'
../mol-plugin/commands
'
;
import
{
PluginUIContext
}
from
'
./context
'
;
import
{
PluginUIContext
}
from
'
./context
'
;
import
{
OpenFiles
}
from
'
../mol-plugin-state/actions/file
'
;
import
{
Asset
}
from
'
../mol-util/assets
'
;
export
class
Plugin
extends
React
.
Component
<
{
plugin
:
PluginUIContext
},
{}
>
{
export
class
Plugin
extends
React
.
Component
<
{
plugin
:
PluginUIContext
},
{}
>
{
region
(
kind
:
'
left
'
|
'
right
'
|
'
bottom
'
|
'
main
'
,
element
:
JSX
.
Element
)
{
region
(
kind
:
'
left
'
|
'
right
'
|
'
bottom
'
|
'
main
'
,
element
:
JSX
.
Element
)
{
...
@@ -102,22 +104,34 @@ class Layout extends PluginUIComponent {
...
@@ -102,22 +104,34 @@ class Layout extends PluginUIComponent {
onDrop
=
(
ev
:
React
.
DragEvent
<
HTMLDivElement
>
)
=>
{
onDrop
=
(
ev
:
React
.
DragEvent
<
HTMLDivElement
>
)
=>
{
ev
.
preventDefault
();
ev
.
preventDefault
();
le
t
file
:
File
|
undefined
|
null
;
cons
t
file
s
:
File
[]
=
[]
;
if
(
ev
.
dataTransfer
.
items
)
{
if
(
ev
.
dataTransfer
.
items
)
{
// Use DataTransferItemList interface to access the file(s)
// Use DataTransferItemList interface to access the file(s)
for
(
let
i
=
0
;
i
<
ev
.
dataTransfer
.
items
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ev
.
dataTransfer
.
items
.
length
;
i
++
)
{
if
(
ev
.
dataTransfer
.
items
[
i
].
kind
!==
'
file
'
)
continue
;
if
(
ev
.
dataTransfer
.
items
[
i
].
kind
!==
'
file
'
)
continue
;
file
=
ev
.
dataTransfer
.
items
[
i
].
getAsFile
();
const
file
=
ev
.
dataTransfer
.
items
[
i
].
getAsFile
();
break
;
if
(
file
)
files
.
push
(
file
)
;
}
}
}
else
{
}
else
{
file
=
ev
.
dataTransfer
.
files
[
0
];
for
(
let
i
=
0
;
i
<
ev
.
dataTransfer
.
files
.
length
;
i
++
)
{
const
file
=
ev
.
dataTransfer
.
files
[
0
];
if
(
file
)
files
.
push
(
file
);
}
}
}
if
(
!
file
)
return
;
const
fn
=
file
?.
name
.
toLowerCase
()
||
''
;
const
sessions
=
files
.
filter
(
f
=>
{
if
(
fn
.
endsWith
(
'
molx
'
)
||
fn
.
endsWith
(
'
molj
'
))
{
const
fn
=
f
.
name
.
toLowerCase
();
PluginCommands
.
State
.
Snapshots
.
OpenFile
(
this
.
plugin
,
{
file
});
return
fn
.
endsWith
(
'
.molx
'
)
||
fn
.
endsWith
(
'
.molj
'
);
});
if
(
sessions
.
length
>
0
)
{
PluginCommands
.
State
.
Snapshots
.
OpenFile
(
this
.
plugin
,
{
file
:
sessions
[
0
]
});
}
else
{
this
.
plugin
.
runTask
(
this
.
plugin
.
state
.
data
.
applyAction
(
OpenFiles
,
{
files
:
files
.
map
(
f
=>
Asset
.
File
(
f
)),
format
:
{
name
:
'
auto
'
,
params
:
{}
},
visuals
:
true
}));
}
}
}
}
...
...
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