This commit is contained in:
Firesieht 2022-10-31 20:17:33 +03:00
parent 73d12f3e62
commit f29736c93a

View File

@ -102,10 +102,8 @@ function createDraws(drawsData) {
function postCircles() { function postCircles() {
circlesAttrs = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().filter(e => e.attrs.name == 'circle-group').map( circlesAttrs = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().filter(e => e.attrs.name == 'circle-group').map(
(e) => { (e) => {
console.log(e, "eeeeee")
return e.children.filter( return e.children.filter(
(ee) => { (ee) => {
console.log(e)
return ee.attrs.name == 'shape' return ee.attrs.name == 'shape'
} }
).map(e => e.attrs) ).map(e => e.attrs)
@ -131,10 +129,8 @@ function postCircles() {
function postRois() { function postRois() {
roisAttrs = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().filter(e => e.attrs.name == 'roi-group').map( roisAttrs = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().filter(e => e.attrs.name == 'roi-group').map(
(e) => { (e) => {
console.log(e, "eeeeee")
return e.children.filter( return e.children.filter(
(ee) => { (ee) => {
console.log(e)
return ee.attrs.name == 'shape' return ee.attrs.name == 'shape'
} }
).map(e => e.attrs) ).map(e => e.attrs)
@ -195,6 +191,8 @@ function receiveMessage(event)
} }
else if (data.type == 'deleteSelected') { else if (data.type == 'deleteSelected') {
app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().find('#'+findActive())[0].destroy() app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().find('#'+findActive())[0].destroy()
parent.postMessage({'type': 'returnDrawsDelete', data: postDraws()}, "*")
} }
else if (data.type == 'setContrast') { else if (data.type == 'setContrast') {
document.getElementById("layerGroup0").style = `filter: contrast(${data.data}%);` document.getElementById("layerGroup0").style = `filter: contrast(${data.data}%);`
@ -221,7 +219,6 @@ function findActive() {
return e.children.filter((e) => e.attrs.name == 'anchor') return e.children.filter((e) => e.attrs.name == 'anchor')
})) }))
active = new Set(activeCandidates.flat().map(e => e.parent.id())) active = new Set(activeCandidates.flat().map(e => e.parent.id()))
console.log(activeCandidates, active)
return [...active][0] return [...active][0]
} }
@ -233,9 +230,9 @@ app.addEventListener('loadend', function () {
//app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm']) //app.loadURLs(['https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'])
app.addEventListener('load', () => { app.addEventListener('load', () => {
app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().addEventListener('mouseup', () => { // app.getActiveLayerGroup().getActiveDrawLayer().getKonvaStage().addEventListener('mouseup', () => {
parent.postMessage({'type': 'returnDraws', data: postDraws()}, "*") // parent.postMessage({'type': 'returnDraws', data: postDraws()}, "*")
}) // })
// createCircle({ // createCircle({
// type: 'Circle', // type: 'Circle',
// center: { // center: {