Переглянути джерело

Update 'src/app/core/models/components/component-options.js'

Added header
Changes to use object constructor "description" (app/core/models/components/component-options.js) in button (app/core/application/menu.js)
New field to new ComponentOptions(...):
Added new parameter "description," in: constructor(id, title, description, icon, componentType)
Added try/catch to allow run under some errors
leo 8 місяців тому
батько
коміт
52f63896f6
1 змінених файлів з 30 додано та 11 видалено
  1. 30 11
      src/app/core/models/components/component-options.js

+ 30 - 11
src/app/core/models/components/component-options.js

@@ -1,14 +1,33 @@
+/*
+ * iGeom by LInE
+ * Free software to student private data
+ *
+ * http://www.matematica.br/igeom
+ * http://www.usp.br/line
+ *
+ * Object with options to each iGeom object (like Circumference)
+ *
+ * ./app/core/models/components/component-options.js
+ * @version 2023/09/20: Added this header and some comments
+ */
+
 import { COMPONENT_TYPE } from "../../enums/component-type-enum";
 
 export class ComponentOptions {
-  constructor(id, title, icon, componentType) {
-    this.id = id;
-    this.title = title;
-    this.icon = icon;
-    this.description;
-    this.type =
-      componentType == undefined
-        ? COMPONENT_TYPE.ELEMENT_DRAWER
-        : componentType;
-  }
-}
+
+  // @see ./app/core/application/menu.js
+  constructor (id, title, description, icon, componentType) {
+    try {
+      this.id = id;
+      this.title = title;
+      this.icon = icon;
+      this.description = description; // "description" will be used by 'title' of each "button"
+      console.log("component-options.js: " + title + " : " + description);
+      this.type = componentType == undefined ? COMPONENT_TYPE.ELEMENT_DRAWER : componentType;
+    } catch (error) {
+      console.log("component-options.js: fail to construct ComponentOptions with id=" + id + " and title=" + title);
+      console.log("* ComponentOptions error: " + error);
+      }
+    }
+
+  }