Browse Source

eslint error fix

ludovic autin 3 years ago
parent
commit
94233fbcd9

+ 1 - 1
src/extensions/cellpack/data.ts

@@ -24,7 +24,7 @@ export interface Cell {
     recipe: Recipe
     cytoplasme?: Packing
     compartments?: { [key: string]: Compartment }
-    mapping_ids?: { [key: number]: [number,string] }
+    mapping_ids?: { [key: number]: [number, string] }
 }
 
 export interface Recipe {

+ 6 - 6
src/extensions/cellpack/representation.ts

@@ -28,7 +28,7 @@ const MembraneSphereParams = {
     cellColor: PD.Color(ColorNames.orange),
     cellScale: PD.Numeric(2, { min: 0.1, max: 5, step: 0.1 }),
     radius: PD.Numeric(2, { min: 0.1, max: 5, step: 0.1 }),
-    center: PD.Vec3(Vec3.create(0,0,0)),
+    center: PD.Vec3(Vec3.create(0, 0, 0)),
     quality: { ...Mesh.Params.quality, isEssential: false },
 };
 
@@ -47,14 +47,14 @@ export type UnitcellProps = PD.Values<MBParams>
 function getMBMesh(data: MembraneSphereData, props: UnitcellProps, mesh?: Mesh) {
     const state = MeshBuilder.createState(256, 128, mesh);
     const radius = props.radius;
-    var p = DefaultPolyhedronProps;
+    let p = DefaultPolyhedronProps;
     p.detail = 3;
     p.radius = radius;
     const { vertices, indices } = Icosahedron();
     const asphere = Polyhedron(vertices, indices, p);
-    //const asphere = Sphere(3);
-    var trans:Mat4 = Mat4.identity();
-    //Mat4.fromScaling(trans, Vec3.create(radius,radius,radius));
+    // const asphere = Sphere(3);
+    let trans: Mat4 = Mat4.identity();
+    // Mat4.fromScaling(trans, Vec3.create(radius,radius,radius));
     state.currentGroup = 1;
     MeshBuilder.addPrimitive(state, trans, asphere);
     const m = MeshBuilder.getMesh(state);
@@ -63,7 +63,7 @@ function getMBMesh(data: MembraneSphereData, props: UnitcellProps, mesh?: Mesh)
 
 function getMBShape(ctx: RuntimeContext, data: MembraneSphereData, props: UnitcellProps, shape?: Shape<Mesh>) {
     const geo = getMBMesh(data, props, shape && shape.geometry);
-    const label = "mb";
+    const label = 'mb';
     return Shape.create(label, data, geo, () => props.cellColor, () => 1, () => label);
 }
 

+ 26 - 26
src/extensions/cellpack/util.ts

@@ -37,7 +37,7 @@ async function downloadPDB(plugin: PluginContext, url: string, id: string, asset
 }
 
 export async function getFromPdb(plugin: PluginContext, pdbId: string, assetManager: AssetManager) {
-    //${pdbId.toUpperCase()}
+    // ${pdbId.toUpperCase()}
     const { cif, asset } = await downloadCif(plugin, `https://models.rcsb.org/${pdbId}.bcif`, true, assetManager);
     return { mmcif: cif.blocks[0], asset };
 }
@@ -77,33 +77,33 @@ export function getStructureMean(structure: Structure) {
     return Vec3.create(xSum / elementCount, ySum / elementCount, zSum / elementCount);
 }
 
-export function getFloatValue(value: DataView, offset : number) {
-  // if the last byte is a negative value (MSB is 1), the final
-  // float should be too
-  const negative = value.getInt8(offset + 2) >>> 31;
+export function getFloatValue(value: DataView, offset: number) {
+    // if the last byte is a negative value (MSB is 1), the final
+    // float should be too
+    const negative = value.getInt8(offset + 2) >>> 31;
 
-  // this is how the bytes are arranged in the byte array/DataView
-  // buffer
-  const [b0, b1, b2, exponent] = [
-      // get first three bytes as unsigned since we only care
-      // about the last 8 bits of 32-bit js number returned by
-      // getUint8().
-      // Should be the same as: getInt8(offset) & -1 >>> 24
-      value.getUint8(offset),
-      value.getUint8(offset + 1),
-      value.getUint8(offset + 2),
+    // this is how the bytes are arranged in the byte array/DataView
+    // buffer
+    const [b0, b1, b2, exponent] = [
+        // get first three bytes as unsigned since we only care
+        // about the last 8 bits of 32-bit js number returned by
+        // getUint8().
+        // Should be the same as: getInt8(offset) & -1 >>> 24
+        value.getUint8(offset),
+        value.getUint8(offset + 1),
+        value.getUint8(offset + 2),
 
-      // get the last byte, which is the exponent, as a signed int
-      // since it's already correct
-      value.getInt8(offset + 3)
-  ];
+        // get the last byte, which is the exponent, as a signed int
+        // since it's already correct
+        value.getInt8(offset + 3)
+    ];
 
-  let mantissa = b0 | (b1 << 8) | (b2 << 16);
-  if (negative) {
-      // need to set the most significant 8 bits to 1's since a js
-      // number is 32 bits but our mantissa is only 24.
-      mantissa |= 255 << 24;
-  }
+    let mantissa = b0 | (b1 << 8) | (b2 << 16);
+    if (negative) {
+        // need to set the most significant 8 bits to 1's since a js
+        // number is 32 bits but our mantissa is only 24.
+        mantissa |= 255 << 24;
+    }
 
-  return mantissa * Math.pow(10, exponent);
+    return mantissa * Math.pow(10, exponent);
 }