Skip to content

Commit

Permalink
filter empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvoigt committed Jul 17, 2024
1 parent 5c4f442 commit 2d2538e
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/components/DocumentHeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class="top-title"
:style="{ left: marginPerc + '%', width: titlePerc + '%' }"
id="draghandle-header"
@dblclick="dblclick"
>
<div class="pagenr recto">
<div :style="headerStyle">{{ rectopage }}</div>
Expand Down Expand Up @@ -280,6 +281,9 @@ export default {
// console.log(this.sourcePosition)
this.$store.commit(mutations.MOVE_SOURCE, { id: this.sourceId, ...this.sourcePosition })
this.$emit('move-source', this.sourcePosition.x, this.sourcePosition.y)
},
dblclick (e) {
alert(this.source.label)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/complaints/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const getters = {
[n.getters.complaintMovements]: (state, getters) => (workId) => {
// console.log('complaintMovements', workId)
const complaints = workId ? getters[n.getters.workComplaints](workId, false) : getters[n.getters.allComplaints]
const movements = [...new Set(complaints.map(c => c.affects[0].mdiv))]
const movements = [...new Set(complaints.map(c => c.affects[0]?.mdiv).filter(cmd => !!cmd))]
// console.log(workId, complaints, movements)
return movements.sort((mdiv1, mdiv2) => {
const m1 = getters[n.getters.getMovementById](mdiv1)
Expand Down
9 changes: 9 additions & 0 deletions src/store/directory/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,14 @@
"start": 2027,
"finish": 2029
}
},
"bibliolinks": {
"D-B, Mus. ms. autogr. Beethoven, L. v. 15": "https://digital.staatsbibliothek-berlin.de/werkansicht?PPN=PPN791342433&amp;PHYSID=PHYS_0001&amp;DMDID=DMDLOG_0001",
"D-BNba, C 73/9": "https://www.beethoven.de/de/media/view/5588323808575488/scan/0",
"US-NYj, 31 B393cp no. 5 errata": "https://juilliardmanuscriptcollection.org/manuscript/piano-concerto-no-5-op-73-e-flat-major/",
"D-BNba, Slg. H. C. Bodmer, HCB BBr 9": "https://www.beethoven.de/de/media/view/6515349549744128/scan/0",
"D-BNba, NE 157": "https://www.beethoven.de/de/media/view/6016726059712512/scan/0",
"A-Wn, SH.Beethoven.323": "http://digital.onb.ac.at/RepViewer/viewer.faces?doc=DTL_7883193&amp;order=1&amp;view=SINGLE"
}
}

7 changes: 5 additions & 2 deletions src/store/directory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import config from '@/config'
const state = {
[n.state.directory_works]: [],
[n.state.directory_modules]: [],
[n.state.directory_dev_works]: []
[n.state.directory_dev_works]: [],
bibliolinks: {}
}
const mutations = {}
const actions = {
Expand Down Expand Up @@ -32,6 +33,7 @@ const actions = {
}
}
state[n.state.directory_modules] = db.modules
state.bibliolinks = db.bibliolinks
// console.log(getters[n.getters.directory_modules])
}
}
Expand All @@ -42,7 +44,8 @@ const getters = {
[n.getters.directory_get_module]: (state) => (key) => state[n.state.directory_modules][key],
[n.getters.directory_is_dev_work]: (state) => (work) => {
return !!(state[n.state.directory_dev_works].find(w => w.id === work))
}
},
get_bibliolink: (state) => (signa) => state.bibliolinks[signa]
}

const directoryModule = {
Expand Down
49 changes: 48 additions & 1 deletion src/toolbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,51 @@ export const filterOrCol = (filters) => (c) => {
return false
}

export default { uuidv4, atId, parsexywh, toRoman, createImageFromText, findPrevious, findNext, desktopTile }
/**
* calculate edit distance (Lvenshtein)
* @param {string} A first string
* @param {string} B second string
* @returns {int} edit distance
*/
export const editdist = (A, B) => {
const X = A.length + 1
const Y = B.length + 1

// prepare matrix ...
const row = function * (x, y) {
if (y === 0) { // first row counts chars of A
for (var i = 0; i < x; i++) {
yield i
}
} else { // others counts chars of B in first column
yield y
for (i = 1; i < x; i++) {
yield 0
}
}
}
const matrix = function * (x, y) {
for (var i = 0; i < y; i++) {
const r = [...row(X, i)]
yield r
}
}
const m = [...matrix(X, Y)]
// ... matrix prepared

// calc edit distance with dynamic programming
for (var y = 1; y < Y; y++) {
for (var x = 1; x < X; x++) {
if (A[x - 1] === B[y - 1]) {
// if chars are equal
m[y][x] = m[y - 1][x - 1]
} else {
// if chars are not equal
m[y][x] = Math.min(m[y - 1][x - 1], m[y][x - 1], m[y - 1][x]) + 1
}
}
}
return m[Y - 1][X - 1]
}

export default { uuidv4, atId, parsexywh, toRoman, createImageFromText, findPrevious, findNext, desktopTile, editdist }
2 changes: 1 addition & 1 deletion start-dev.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker compose up -d && npm run serve ; docker-compose down
docker compose up -d && npm run serve ; docker compose down

0 comments on commit 2d2538e

Please sign in to comment.