| 23 |
|
|
| 24 |
Drupal.imageAnnotationOptions = { |
Drupal.imageAnnotationOptions = { |
| 25 |
preShow: function() { |
preShow: function() { |
| 26 |
$this = $(this); |
var $this = $(this); |
| 27 |
$canvas = $this.parents('.image-annotate-canvas'); |
var $canvas = $this.parents('.image-annotate-canvas'); |
| 28 |
|
$this.find('>div').hide(); |
| 29 |
$this.resizable({ |
$this.resizable({ |
| 30 |
handles: 'all', |
handles: 'all', |
| 31 |
resize: function(e, ui) { |
resize: function(e, ui) { |
| 50 |
}) |
}) |
| 51 |
.draggable({ |
.draggable({ |
| 52 |
containment: $canvas, |
containment: $canvas, |
| 53 |
}); |
}) |
| 54 |
|
.data('imageAnnotationOriginalPosition', $this.position()); |
| 55 |
}, |
}, |
| 56 |
submit: function() { |
submit: function() { |
| 57 |
$this = $(this); |
var $this = $(this); |
| 58 |
$('#edit-annotation-image-field', this.annotationForm).attr('value', $this.parents('.field-item').find('>a.image-annotate-add').attr('id').match(/[^-]*$/)); |
$('#edit-annotation-image-field', this.annotationForm).attr('value', $this.parents('.field-item').find('>a.image-annotate-add').attr('id').match(/[^-]*$/)); |
| 59 |
$('#edit-annotation-image-top', this.annotationForm).attr('value', $this.position().top); |
$('#edit-annotation-image-top', this.annotationForm).attr('value', $this.position().top); |
| 60 |
$('#edit-annotation-image-left', this.annotationForm).attr('value', $this.position().left); |
$('#edit-annotation-image-left', this.annotationForm).attr('value', $this.position().left); |
| 62 |
$('#edit-annotation-image-height', this.annotationForm).attr('value', $this.height()); |
$('#edit-annotation-image-height', this.annotationForm).attr('value', $this.height()); |
| 63 |
}, |
}, |
| 64 |
postHide: function() { |
postHide: function() { |
| 65 |
$(this).resizable('destroy') |
var $this = $(this); |
| 66 |
|
var position = $this.data('imageAnnotationOriginalPosition'); |
| 67 |
|
$this.resizable('destroy') |
| 68 |
.draggable('destroy') |
.draggable('destroy') |
| 69 |
.css('height', '') |
.css('height', '') |
| 70 |
.css('width', '') |
.css('width', '') |
| 71 |
.css('left', '') |
.css('left', position.left + 'px') |
| 72 |
.css('top', '') |
.css('top', position.top + 'px') |
| 73 |
.parents('.image-annotate-edit').hide(); |
.parents('.image-annotate-edit').hide(); |
| 74 |
|
$this.find('>div').show(); |
| 75 |
} |
} |
| 76 |
}; |
}; |