|
@@ -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 {
|
|
class Menu {
|
|
|
|
+
|
|
|
|
+ // @see ./app/core/models/components/component-options.js: class ComponentOptions
|
|
|
|
+ // ComponentOptions has fields {id, title, icon, description, type}
|
|
|
|
+
|
|
constructor() {
|
|
constructor() {
|
|
this.tools = [];
|
|
this.tools = [];
|
|
$("#tools").empty();
|
|
$("#tools").empty();
|
|
- }
|
|
|
|
- add(component) {
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ add (component) {
|
|
this.tools.push(component);
|
|
this.tools.push(component);
|
|
- }
|
|
|
|
- refresh() {
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ refresh () {
|
|
this.tools
|
|
this.tools
|
|
.filter(component => {
|
|
.filter(component => {
|
|
return component.created == undefined;
|
|
return component.created == undefined;
|
|
- })
|
|
|
|
|
|
+ })
|
|
.forEach(component => {
|
|
.forEach(component => {
|
|
|
|
+ // Put each iGeom option button (as "build Circumference")
|
|
if (component != undefined && component.created) return;
|
|
if (component != undefined && component.created) return;
|
|
component.created = true;
|
|
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}"
|
|
$("#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>`);
|
|
<span> ${options.title} </span></button>`);
|
|
$("body").on(
|
|
$("body").on(
|
|
"click",
|
|
"click",
|
|
`#btn-${options.id}`,
|
|
`#btn-${options.id}`,
|
|
component.click.bind(component)
|
|
component.click.bind(component)
|
|
- );
|
|
|
|
- });
|
|
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
-export const menu = new Menu();
|
|
|
|
|
|
+
|
|
|
|
+export const menu = new Menu();
|