From 2818c7b09f74310371c05bcf83c95eff830a9e68 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Sun, 10 Apr 2022 02:36:50 -0500 Subject: [PATCH 1/3] Finish chart editing support --- src/components/RangeChart.vue | 110 ++++++++++++++++++++++++++++++ src/pages/Editor.vue | 71 +++++++++++++++++++- src/pages/RangeChartEditor.vue | 118 +++++++++++++++++++++++++++++++++ src/support/page.ts | 10 +++ src/support/types.ts | 13 ++++ 5 files changed, 320 insertions(+), 2 deletions(-) create mode 100644 src/components/RangeChart.vue create mode 100644 src/pages/RangeChartEditor.vue diff --git a/src/components/RangeChart.vue b/src/components/RangeChart.vue new file mode 100644 index 0000000..25fc305 --- /dev/null +++ b/src/components/RangeChart.vue @@ -0,0 +1,110 @@ + + + diff --git a/src/pages/Editor.vue b/src/pages/Editor.vue index d76ae09..eb3e378 100644 --- a/src/pages/Editor.vue +++ b/src/pages/Editor.vue @@ -3,7 +3,7 @@ import {onMounted, ref} from 'vue' import { v4 as uuidv4 } from 'uuid' import {MathPage} from '../support/page' import {MathStatement} from '../support/parse' -import {EvaluationResult, hasOwnProperty} from '../support/types' +import {ChartBox, EvaluationResult, hasOwnProperty} from '../support/types' import Statement from '../components/Statement.vue' import VarDeclEditor from './VarDeclEditor.vue' import ExpressionEditor from './ExpressionEditor.vue' @@ -11,6 +11,8 @@ import TextBox from '../components/TextBox.vue' import {RichTextBox} from '../support/types' import { stepX, stepY } from '../support/const' import FunctionEditor from '../components/FunctionEditor.vue' +import RangeChart from '../components/RangeChart.vue' +import RangeChartEditor from './RangeChartEditor.vue' const math = new MathPage(uuidv4()); const statements = ref([]); @@ -185,6 +187,39 @@ const makeNewRichTextBox = () => { richEditModal.value = true; }; +const chartBoxKey = ref(uuidv4()) +const chartBoxes = ref([]) + +const newChartModalOpen = ref(false) +const openNewChartModal = () => { + newChartModalOpen.value = true +} + +const saveNewChartBox = (chartBox: ChartBox) => { + chartBoxes.value.push(chartBox) + newChartModalOpen.value = false +} + +const editingChartBox = ref() +const chartEditModalOpen = ref(false) +const openChartEditModal = (box: ChartBox) => { + editingChartBox.value = box + chartEditModalOpen.value = true +} + +const saveEditingChartBox = () => { + chartEditModalOpen.value = false + chartBoxKey.value = uuidv4() +} + +const moveChartBox = (id: number, x: number, y: number) => { + chartBoxes.value[id].x = x + chartBoxes.value[id].y = y +} +const removeChartBox = (id: number) => { + chartBoxes.value.splice(id, 1); +}; + const richTextStatements = ref([]); const richEditModal = ref(false); @@ -290,6 +325,17 @@ const removeRichTextBox = (id: number) => { + + + + { /> + + + + + + + + { /> + diff --git a/src/pages/RangeChartEditor.vue b/src/pages/RangeChartEditor.vue new file mode 100644 index 0000000..b7e59e1 --- /dev/null +++ b/src/pages/RangeChartEditor.vue @@ -0,0 +1,118 @@ + + + diff --git a/src/support/page.ts b/src/support/page.ts index cb2336e..377c72c 100644 --- a/src/support/page.ts +++ b/src/support/page.ts @@ -128,6 +128,16 @@ export class MathPage { .filter(x => x.isFunctionDeclaration()) } + /** Look up a function statement by name, if it exists. */ + getFunctionByName(name: string): MathStatement|undefined { + for ( const fn of this.functions() ) { + const node = fn.parse() as math.FunctionAssignmentNode + if ( node.name === name ) { + return fn + } + } + } + /** Evaluate the current state of the page and get the result. */ evaluate(): EvaluationResult { const evaluations: Record = {} diff --git a/src/support/types.ts b/src/support/types.ts index 533e3aa..004c1ce 100644 --- a/src/support/types.ts +++ b/src/support/types.ts @@ -111,3 +111,16 @@ export class ImageBox { } +export class ChartBox { + // eslint-disable-next-line max-params + constructor( + public fnName: string, + public minX: number, + public maxX: number, + public stepX: number = 1, + public x: number = 0, + public y: number = 0, + ) {} +} + + From 5c305a088d6fab768ea14cb3fc2fca3ff1fd1383 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 10 Apr 2022 02:45:45 -0500 Subject: [PATCH 2/3] my changes on the ui and theme --- src/App.vue | 7 +++---- src/assets/grid.svg | 4 ++-- src/main.ts | 2 +- src/pages/Editor.vue | 40 +++++++++++++++++++++------------------ src/quasar-variables.sass | 4 ++-- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/App.vue b/src/App.vue index ce01029..2d74dbe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -54,7 +54,7 @@ Dark.set(true) diff --git a/src/quasar-variables.sass b/src/quasar-variables.sass index edc3022..ad6e563 100644 --- a/src/quasar-variables.sass +++ b/src/quasar-variables.sass @@ -1,5 +1,5 @@ $primary : #553564 -$secondary : #26A69A +$secondary : #008e80 $accent : #9C27B0 $dark : #1D1D1D @@ -8,5 +8,5 @@ $dark : #1D1D1D $positive : #21BA45 $negative : #C10015 -$info : #31CCEC +$info : #7da9b2 $warning : #F2C037 \ No newline at end of file From 17a6aea76db7a943a190d4db6524e6b16c01392e Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 10 Apr 2022 02:52:30 -0500 Subject: [PATCH 3/3] rendered logo to path --- src/assets/l2.svg | 59 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/src/assets/l2.svg b/src/assets/l2.svg index f45c422..1d6e8b2 100644 --- a/src/assets/l2.svg +++ b/src/assets/l2.svg @@ -19,20 +19,20 @@ bordercolor="#000000" borderopacity="0.25" inkscape:pageshadow="2" - inkscape:pageopacity="0.0" - inkscape:pagecheckerboard="0" + inkscape:pageopacity="0" + inkscape:pagecheckerboard="true" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="false" - inkscape:zoom="0.51843089" - inkscape:cx="-180.35191" - inkscape:cy="555.52245" + inkscape:zoom="0.733172" + inkscape:cx="497.15483" + inkscape:cy="634.23044" inkscape:window-width="1920" inkscape:window-height="1001" inkscape:window-x="-7" inkscape:window-y="-7" inkscape:window-maximized="1" - inkscape:current-layer="layer2"> + inkscape:current-layer="g5278"> @@ -49,30 +49,29 @@ inkscape:label="Text" transform="matrix(0.26458333,0,0,0.26458333,10.166581,13.777983)" style="fill:#550000"> - C - M + + + + + + + +