|
@@ -1,29 +1,57 @@
|
|
|
+/*
|
|
|
+ * iGeom by LInE
|
|
|
+ * Free software to student private data
|
|
|
+ *
|
|
|
+ * http://www.matematica.br/igeom
|
|
|
+ * http://www.usp.br/line
|
|
|
+ *
|
|
|
+ * Treat object Menu (File | Edit)
|
|
|
+ *
|
|
|
+ * ./app/core/application/menu.js
|
|
|
+ * @version 2023/09/20: Added this header and some comments
|
|
|
+ */
|
|
|
+
|
|
|
class Menu {
|
|
|
+
|
|
|
+ // @see ./app/core/models/components/component-options.js: class ComponentOptions
|
|
|
+ // ComponentOptions has fields {id, title, icon, description, type}
|
|
|
+
|
|
|
constructor() {
|
|
|
this.tools = [];
|
|
|
$("#tools").empty();
|
|
|
- }
|
|
|
- add(component) {
|
|
|
+ }
|
|
|
+
|
|
|
+ add (component) {
|
|
|
this.tools.push(component);
|
|
|
- }
|
|
|
- refresh() {
|
|
|
+ }
|
|
|
+
|
|
|
+ refresh () {
|
|
|
this.tools
|
|
|
.filter(component => {
|
|
|
return component.created == undefined;
|
|
|
- })
|
|
|
+ })
|
|
|
.forEach(component => {
|
|
|
+ // Put each iGeom option button (as "build Circumference")
|
|
|
if (component != undefined && component.created) return;
|
|
|
component.created = true;
|
|
|
- const options = component.options;
|
|
|
+ const options = component.options; // defined on ./app/core/models/components/component-options.js (using ComponentOptions)
|
|
|
+
|
|
|
+ console.log("menu.js: " + options.title + " : " + options.description);
|
|
|
+
|
|
|
+ //TODO It is missign 'internationalization'!
|
|
|
+
|
|
|
+ // Each object has its associated button, each one with "ComponentOptions" that define its "desciption"
|
|
|
+ // (to be used on "title" bellow)
|
|
|
$("#tools").append(`<button id="btn-${options.id}"
|
|
|
- class="tool icon icon-${options.icon} fadeInRight">
|
|
|
+ class="tool icon icon-${options.icon} fadeInRight" title="${options.description}">
|
|
|
<span> ${options.title} </span></button>`);
|
|
|
$("body").on(
|
|
|
"click",
|
|
|
`#btn-${options.id}`,
|
|
|
component.click.bind(component)
|
|
|
- );
|
|
|
- });
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
-export const menu = new Menu();
|
|
|
+
|
|
|
+export const menu = new Menu();
|