remove bug with no save roi

This commit is contained in:
ilia 2022-10-29 15:54:01 +03:00
parent 4da2145867
commit d1108af0c4

View File

@ -103,13 +103,23 @@ function postCircles() {
} }
function postRois() { function postRois() {
console.log(app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().children) roisAttrs = app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().getChildren().filter(e => e.attrs.name == 'roi-group').map(
return app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().children.filter( (e) => {
e => e.attrs.name == 'roi-group' console.log(e, "eeeeee")
).map(e => { return e.children.filter(
return e.children.filter(e => e.attrs.name == 'shape')[0].attrs (ee) => {
}).flat().map((e) => { console.log(e)
var points = [] return ee.attrs.name == 'shape'
}
).map(e => e.attrs)
}
)
roisAttrs = roisAttrs.concat(app.getActiveLayerGroup().getActiveDrawLayer().getKonvaLayer().children[0].children.filter(e => e.attrs.name == 'roi-group').map((e) => {
return e.children.filter((e) => e.attrs.name == 'shape').map(e => e.attrs)
}))
return roisAttrs.flat().map((e) => {
var points = [];
console.log(e.points)
for (var i = 0; i < e.points.length; i+=2) { for (var i = 0; i < e.points.length; i+=2) {
points.push({x: e.points[i], y: e.points[i+1]}) points.push({x: e.points[i], y: e.points[i+1]})
} }
@ -179,13 +189,24 @@ app.addEventListener('load', () => {
}, },
radius: 100 radius: 100
}) })
createRoi({
type: 'Roi',
points: [
{
x: 100, y: 100
},
{
x: 10, y: 100
}
]
})
app.setDrawShape('Roi') app.setDrawShape('Roi')
setTimeout(() => { setTimeout(() => {
app.setDrawShape('Circle') app.setDrawShape('Circle')
}, 3000) }, 3000)
setTimeout(() => { setTimeout(() => {
console.log(postRois()) console.log(postDraws())
}, 2000) }, 5000)
}) })
app.addEventListener('slicechange', function () { app.addEventListener('slicechange', function () {