Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-154: Enable display of all grid scan snapshots in full #631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions client/src/js/modules/dc/views/gridplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ define(['jquery', 'marionette',
hmt: 'input[name=heatmap]',
ty: 'select[name=type]',
ty2: 'select[name=type2]',
ty3: 'select[name=type3]',
xfm: '.xfm',
flu: 'input[name=fluo]',
el: 'select[name=element]',
sns: 'a[name=snapshots]',
},

events: {
Expand All @@ -36,6 +38,7 @@ define(['jquery', 'marionette',

'change @ui.ty': 'setType',
'change @ui.ty2': 'loadAttachment',
'change @ui.ty3': 'loadImage',
'change @ui.hmt': 'setHM',

'change @ui.flu': 'toggleFluo',
Expand Down Expand Up @@ -97,6 +100,7 @@ define(['jquery', 'marionette',
this.offset_h = 0
this.scale = 1
this.current = -1
this.image_1_width = -1

this.heatmapToggle = false

Expand Down Expand Up @@ -144,6 +148,28 @@ define(['jquery', 'marionette',
}
},

populateImageSelect: function() {
opts = []
for (let i=1; i<=4; i++) {
if (this.getOption('parent').get('X'+i)) {
opts.push('<option value='+i+'>Image '+i+'</option>')
if (i === 1) {
// show button to view image full size
this.ui.sns.append('<a class="button" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+i+'"><i class="fa fa-arrows"></a>')
} else {
this.ui.sns.append('<a class="hidden" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+i+'"></a>')
}
}
}
if (opts.length > 1) {
this.ui.ty3.html(opts).show()
}
},

loadImage: function() {
var n = this.ui.ty3.val()
this.snapshot.load(app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+n)
},

toggleFluo: function() {
if (this.ui.flu.is(':checked')) {
Expand Down Expand Up @@ -242,11 +268,18 @@ define(['jquery', 'marionette',
this.hasSnapshot = true
this.$el.removeClass('loading')
this.draw()
if (this.ui.ty3.val() == 1) {
this.image_1_width = this.snapshot.width
}
var n = this.ui.ty3.val()
this.ui.sns.magnificPopup({ type: 'image', delegate: 'a', gallery: { enabled:true } })
},

onRender: function() {
this.ui.xfm.hide()
this.ui.ty2.hide()
this.ui.ty3.hide()
this.populateImageSelect()
},


Expand Down Expand Up @@ -315,6 +348,17 @@ define(['jquery', 'marionette',
h *= scalef
}

if (this.image_1_width > 0 && this.snapshot.width != this.image_1_width) {
// Image size is different to image 1, so hide PIA results as they would be in the wrong location
this.ui.ty.val(-1)
this.ui.ty2.val('')
this.ui.ty.prop('disabled', true)
this.ui.ty2.prop('disabled', true)
} else {
this.ui.ty.prop('disabled', false)
this.ui.ty2.prop('disabled', false)
}

var cvratio = this.perceivedw / this.perceivedh
var snratio = w/h

Expand Down
5 changes: 4 additions & 1 deletion client/src/js/templates/dc/gridplot.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<div class="controls">
<a name="snapshots"></a>
<select name="type3"></select>

<select name="type">
<option value="0">Spots</option>
<option value="1">Bragg</option>
Expand All @@ -13,4 +16,4 @@
<select name="element"></select>
</span>
</div>
<canvas></canvas>
<canvas></canvas>
Loading