-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from 0gust1/feat/first_control_component
Feat/first control component
- Loading branch information
Showing
11 changed files
with
185 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script lang="ts"> | ||
import { getContext } from 'svelte'; | ||
import { fade } from 'svelte/transition'; | ||
import type { PluginContext } from 'molstar/lib/mol-plugin/context'; | ||
const plugin = getContext<{ getPlugin: () => PluginContext }>('molstar').getPlugin(); | ||
const highlightS = plugin.behaviors.labels.highlight; | ||
let clazz = ''; | ||
export { clazz as class }; | ||
</script> | ||
|
||
{#if $highlightS?.labels.length > 0} | ||
<div class="molstar-svelte-highlight-info ${clazz || ''}" transition:fade={{ duration: 100 }}> | ||
{#each $highlightS.labels as label} | ||
{@html label} | ||
{/each} | ||
</div> | ||
{/if} | ||
|
||
<style lang="postcss"> | ||
.molstar-svelte-highlight-info { | ||
@apply absolute right-0 bottom-0 p-2 m-2 rounded bg-slate-400 border border-slate-500 text-white text-xs; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { PluginConfig } from 'molstar/lib/mol-plugin/config.js'; | ||
import type { PluginSpec } from 'molstar/lib/mol-plugin/spec.js'; | ||
import { Color } from 'molstar/lib/mol-util/color/color.js'; | ||
|
||
export const defaultPluginSpec: Partial<PluginSpec> = { | ||
config: [[PluginConfig.VolumeStreaming.Enabled, false]], | ||
canvas3d: { | ||
postprocessing: { | ||
occlusion: { | ||
name: 'on', | ||
params: { | ||
samples: 32, | ||
radius: 6, | ||
bias: 1.4, | ||
multiScale: { name: 'off', params: {} }, | ||
blurKernelSize: 15, | ||
resolutionScale: 1 | ||
} | ||
}, | ||
outline: { name: 'on', params: { scale: 1, threshold: 0.99, color: Color(0x000000) } } | ||
}, | ||
renderer: { | ||
ambientIntensity: 1.0, | ||
light: [ | ||
//{ color: Color(0xffffff), azimuth: 1.0, inclination: 180, intensity: 1.0 } | ||
], | ||
backgroundColor: 0x001f42 as Color | ||
} | ||
} | ||
//config:[[PluginConfig.Structure.DefaultRepresentationPreset, ViewerAutoPreset.id],] | ||
}; | ||
|
||
export const defaultCanvas3dSettings = { | ||
settings: { | ||
/* renderer: { | ||
...renderer, | ||
ambientIntensity: 1.0, | ||
light: [], | ||
backgroundColor: 0x001f42 as Color | ||
}, */ | ||
cameraResetDurationMs: 100, | ||
trackball: { | ||
noScroll: true | ||
}, | ||
postprocessing: { | ||
occlusion: { | ||
name: 'on', | ||
params: { | ||
multiScale: { name: 'off', params: {} }, | ||
samples: 32, | ||
radius: 6, | ||
bias: 1.4, | ||
blurKernelSize: 15, | ||
resolutionScale: 1 | ||
} | ||
}, | ||
outline: { name: 'on', params: { scale: 1, threshold: 0.33, color: Color(0x000000) } } | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script lang="ts"> | ||
import { browser} from '$app/environment'; | ||
|
||
|
||
const loadComponentDemoWithControls = async () => | ||
import('./DemoControls.svelte').then((m) => { | ||
return m.default; | ||
}); | ||
|
||
</script> | ||
|
||
# SimpleWrapper + controls | ||
|
||
## Highlight info | ||
|
||
{#if browser} | ||
{#await loadComponentDemoWithControls() then MolstarComp} | ||
<svelte:component this={MolstarComp} /> | ||
{/await} | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<script lang="ts"> | ||
import StructureURL from '$lib/elements/StructureURL.svelte'; | ||
import HighlightInfo from '$lib/controls/HighlightInfo.svelte'; | ||
import MolstarWrapper from '$lib/wrappers/SimpleWrapper.svelte'; | ||
export let structuresURLs = [ | ||
{ url: 'https://files.rcsb.org/view/7YUB.cif', type: 'mmcif' }, | ||
{ url: 'https://alphafold.ebi.ac.uk/files/AF-P00533-F1-model_v4.cif', type: 'mmcif' } | ||
]; | ||
let selectedStructuresURLs = [...structuresURLs]; | ||
</script> | ||
|
||
<MolstarWrapper class="h-96 relative"> | ||
<svelte:fragment slot="inside"> | ||
{#each selectedStructuresURLs as structureURL (`${structureURL.url}-${structureURL.type}`)} | ||
<StructureURL url={structureURL.url} type={structureURL.type} /> | ||
{/each} | ||
<HighlightInfo /> | ||
</svelte:fragment> | ||
<svelte:fragment slot="outside"> | ||
<div> | ||
Displaying: | ||
{#each selectedStructuresURLs as structureURL (`${structureURL.url}-${structureURL.type}`)} | ||
<p class="text-xs"><span>{structureURL.url}</span> <span>({structureURL.type})</span></p> | ||
{/each} | ||
</div> | ||
</svelte:fragment> | ||
</MolstarWrapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters