From d6881adb256894f9edd46ec3006b75e407e9815e Mon Sep 17 00:00:00 2001 From: Patrick Altman Date: Tue, 9 Jun 2020 15:24:33 -0500 Subject: [PATCH 01/12] Add new display mode toggle --- src/actions.js | 4 ++++ src/constants.js | 1 + src/mutations.js | 4 ++++ src/widgets/DisplayModeWidget.vue | 22 ++++++++++++++++------ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/actions.js b/src/actions.js index f460faa..c3e1a29 100644 --- a/src/actions.js +++ b/src/actions.js @@ -6,6 +6,7 @@ import { UPDATE_METADATA, FETCH_LIBRARY, SET_PASSAGE, + SET_DISPLAY_MODE_METRICAL, SET_DISPLAY_MODE_INTERLINEAR, SET_DISPLAY_MODE_NAMED_ENTITIES, SET_DISPLAY_MODE_FOLIO, @@ -24,6 +25,9 @@ export default { [SET_DISPLAY_MODE_NAMED_ENTITIES]: ({ commit }) => { commit(SET_DISPLAY_MODE_NAMED_ENTITIES); }, + [SET_DISPLAY_MODE_METRICAL]: ({ commit }) => { + commit(SET_DISPLAY_MODE_METRICAL); + }, [SET_DISPLAY_MODE_FOLIO]: ({ commit }) => { commit(SET_DISPLAY_MODE_FOLIO); }, diff --git a/src/constants.js b/src/constants.js index cb29869..78d9b2c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -3,6 +3,7 @@ export const FETCH_METADATA = 'fetchMetadata'; export const UPDATE_METADATA = 'updateMetadata'; export const FETCH_LIBRARY = 'fetchLibrary'; export const SET_PASSAGE = 'setPassage'; +export const SET_DISPLAY_MODE_METRICAL = 'setDisplayModeMetrical'; export const SET_DISPLAY_MODE_INTERLINEAR = 'setDisplayModeInterlinear'; export const SET_DISPLAY_MODE_NAMED_ENTITIES = 'setDisplayModeNamedEntities'; export const SET_DISPLAY_MODE_DEFAULT = 'setDisplayModeDefault'; diff --git a/src/mutations.js b/src/mutations.js index 833a838..c6a2f94 100644 --- a/src/mutations.js +++ b/src/mutations.js @@ -2,6 +2,7 @@ import { FETCH_METADATA, FETCH_LIBRARY, SET_PASSAGE, + SET_DISPLAY_MODE_METRICAL, SET_DISPLAY_MODE_INTERLINEAR, SET_DISPLAY_MODE_NAMED_ENTITIES, SET_DISPLAY_MODE_FOLIO, @@ -17,6 +18,9 @@ export default { [CLEAR_NAMED_ENTITIES]: state => { state.selectedNamedEntities = []; }, + [SET_DISPLAY_MODE_METRICAL]: state => { + state.displayMode = 'metrical'; + }, [SET_DISPLAY_MODE_NAMED_ENTITIES]: state => { state.displayMode = 'named-entities'; }, diff --git a/src/widgets/DisplayModeWidget.vue b/src/widgets/DisplayModeWidget.vue index 565ea78..15547a6 100644 --- a/src/widgets/DisplayModeWidget.vue +++ b/src/widgets/DisplayModeWidget.vue @@ -9,6 +9,9 @@
Folio Images
+
+ Metrical Annotation +
Named Entities
@@ -21,6 +24,7 @@ SET_DISPLAY_MODE_NAMED_ENTITIES, SET_DISPLAY_MODE_FOLIO, SET_DISPLAY_MODE_DEFAULT, + SET_DISPLAY_MODE_METRICAL, } from '@/constants'; export default { @@ -30,20 +34,23 @@ singleton: true, }, computed: { + displayMode() { + return this.$store.state.displayMode; + }, interlinear() { - return this.$store.state.displayMode === 'interlinear'; + return this.displayMode === 'interlinear'; }, namedEntities() { - return this.$store.state.displayMode === 'named-entities'; + return this.displayMode === 'named-entities'; }, folio() { - return this.$store.state.displayMode === 'folio'; + return this.displayMode === 'folio'; }, defaultMode() { - return this.$store.state.displayMode === 'default'; + return this.displayMode === 'default'; }, - displayMode() { - return this.$store.state.displayMode; + metrical() { + return this.displayMode === 'metrical'; }, }, methods: { @@ -67,6 +74,9 @@ document.getElementsByClassName('main-layout')[0] .classList.remove('main-layout-wide'); }, + setMetrical() { + this.$store.dispatch(SET_DISPLAY_MODE_METRICAL); + }, }, }; From fedec8a820542151c96b5222343d5d641d335aec Mon Sep 17 00:00:00 2001 From: Patrick Altman Date: Tue, 9 Jun 2020 16:18:17 -0500 Subject: [PATCH 02/12] Implement metrical view --- src/reader/components/Reader.vue | 55 +++++++++++++++++++++++++++++ src/reader/widgets/ReaderWidget.vue | 18 ++++++++-- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/reader/components/Reader.vue b/src/reader/components/Reader.vue index 47ec5fb..78ec2da 100644 --- a/src/reader/components/Reader.vue +++ b/src/reader/components/Reader.vue @@ -4,7 +4,9 @@ class="reader-container text" :class="[`text-${textSize}`, `text-width-${textWidth}`]" > +