Ver Fonte

wip, added distance-restraints to canvas example, marking

Alexander Rose há 6 anos atrás
pai
commit
2980b60d74

+ 1 - 0
src/apps/canvas/component/structure-representation.tsx

@@ -53,6 +53,7 @@ export class StructureRepresentationComponent extends React.Component<StructureR
         await repr.createOrUpdate(props).run()
         this.props.viewer.add(repr)
         this.props.viewer.requestDraw()
+        console.log(this.props.viewer.stats)
 
         const newState = {
             ...this.state,

+ 5 - 1
src/apps/canvas/structure-view.ts

@@ -23,6 +23,7 @@ import { PointRepresentation } from 'mol-geo/representation/structure/representa
 import { StructureRepresentation } from 'mol-geo/representation/structure';
 import { BehaviorSubject } from 'rxjs';
 import { SpacefillRepresentation } from 'mol-geo/representation/structure/representation/spacefill';
+import { DistanceRestraintRepresentation } from 'mol-geo/representation/structure/representation/distance-restraint';
 
 export interface StructureView {
     readonly viewer: Viewer
@@ -68,8 +69,9 @@ export async function StructureView(viewer: Viewer, models: ReadonlyArray<Model>
         ballAndStick: false,
         carbohydrate: false,
         spacefill: false,
+        distanceRestraint: false,
         symmetryAxes: false,
-        polymerSphere: false,
+        // polymerSphere: false,
     }
 
     const structureRepresentations: { [k: string]: StructureRepresentation<any> } = {
@@ -78,6 +80,7 @@ export async function StructureView(viewer: Viewer, models: ReadonlyArray<Model>
         ballAndStick: BallAndStickRepresentation(),
         carbohydrate: CarbohydrateRepresentation(),
         spacefill: SpacefillRepresentation(),
+        distanceRestraint: DistanceRestraintRepresentation(),
     }
 
     const symmetryAxes = ShapeRepresentation()
@@ -241,6 +244,7 @@ export async function StructureView(viewer: Viewer, models: ReadonlyArray<Model>
 
         updated.next(null)
         viewer.requestDraw()
+        console.log(viewer.stats)
     }
 
     async function createSymmetryRepr() {

+ 3 - 5
src/mol-view/viewer.ts

@@ -99,9 +99,7 @@ namespace Viewer {
         const ctx = createContext(gl)
 
         const scene = Scene.create(ctx)
-        // const controls = TrackballControls.create(input, scene, {})
         const controls = TrackballControls.create(input, camera, {})
-        // const renderer = Renderer.create(ctx, camera, { clearColor: 0xFFFFFF })
         const renderer = Renderer.create(ctx, camera, { clearColor: Color(0x000000) })
 
         const pickScale = 1
@@ -130,9 +128,9 @@ namespace Viewer {
         }
 
         function mark(loci: Loci, action: MarkerAction) {
-            // reprMap.forEach((roSet, repr) => repr.mark(loci, action))
-            // scene.update()
-            // requestDraw()
+            reprMap.forEach((roSet, repr) => repr.mark(loci, action))
+            scene.update()
+            requestDraw()
         }
 
         let nearPlaneDelta = 0