瀏覽代碼

Issue #877: inside/outside colors on Node.JS; solid bi-layer rim line; output 100x100

cycle20 1 年之前
父節點
當前提交
507f9d1995
共有 3 個文件被更改,包括 14 次插入5 次删除
  1. 1 1
      src/TmImageRenderer/index.ts
  2. 3 3
      src/tmdet-extension/representation.ts
  3. 10 1
      src/tmdet-extension/tmdet-color-theme.ts

+ 1 - 1
src/TmImageRenderer/index.ts

@@ -91,7 +91,7 @@ async function main() {
     // Export images
     fs.mkdirSync(args.outDirectory, { recursive: true });
     setTimeout(async () => {
-            plugin.saveImage(path.join(args.outDirectory, fileName));
+            plugin.saveImage(path.join(args.outDirectory, fileName), { width: 100, height: 100 });
             // Cleanup
             await plugin.clear();
             plugin.dispose();

+ 3 - 3
src/tmdet-extension/representation.ts

@@ -42,9 +42,9 @@ export type BilayerPlanesProps = PD.Values<BilayerPlanesParams>
 const BilayerRimsParams = {
     ...Lines.Params,
     ...SharedParams,
-    lineSizeAttenuation: PD.Boolean(true),
-    linesSize: PD.Numeric(0.3, { min: 0.01, max: 50, step: 0.01 }),
-    dashedLines: PD.Boolean(true),
+    lineSizeAttenuation: PD.Boolean(false),
+    linesSize: PD.Numeric(0.5, { min: 0.01, max: 50, step: 0.01 }),
+    dashedLines: PD.Boolean(false),
 };
 export type BilayerRimsParams = typeof BilayerRimsParams
 export type BilayerRimsProps = PD.Values<BilayerRimsParams>

+ 10 - 1
src/tmdet-extension/tmdet-color-theme.ts

@@ -70,7 +70,7 @@ enum SiteIndexes {
     Periplasm = 8
 };
 
-// Old default values - it is overwritten by ult_* CSS classes
+// Old default values - it is overwritten by ult_* CSS classes, except in case of Node.JS
 // See below updateSiteColors().
 const siteColors = [
     Color.fromArray([255,100,100], 0), // Side1
@@ -96,6 +96,15 @@ const siteCssNames = [
     "ult_periplasm"
 ];
 
+// If runtime env is Node.JS
+if (typeof window === 'undefined') {
+    siteColors.push(
+        Color.fromArray([255,0,0], 0), // Inside
+        Color.fromArray([0,0,255], 0)  // Outside
+    );
+    siteCssNames.push('ult_inside', 'ult_outside' );
+}
+
 const regionColorMapFromCss = new Map();
 
 // set default values