some fixes in 'Transformation' widget

preferencesAboutTextFull
unknown 12 years ago
parent 4eda8fd7d7
commit 56e73ace2a
  1. 41
      resources/library/interactivities/Transformation.wgt/js/lib/ubw-main.js
  2. 5
      resources/library/interactivities/Transformation.wgt/js/main.js

@ -77,6 +77,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) {
log("Toobar Initialisation"); log("Toobar Initialisation");
$("button[role=edit]").click(function(){ $("button[role=edit]").click(function(){
app.onEdit = true; app.onEdit = true;
if(window.sankore)
window.sankore.enableDropOnWidget(app.onEdit);
$(document.body).addClass("onEdit"); $(document.body).addClass("onEdit");
if(callbacks.onEdit && typeof callbacks.onEdit === 'function') { if(callbacks.onEdit && typeof callbacks.onEdit === 'function') {
callbacks.onEdit(app); callbacks.onEdit(app);
@ -84,6 +86,8 @@ function initAfterI18nMessagesLoaded(reload, templates, callbacks) {
}); });
$("button[role=view]").click(function(){ $("button[role=view]").click(function(){
app.onEdit = false; app.onEdit = false;
if(window.sankore)
window.sankore.enableDropOnWidget(app.onEdit);
$(document.body).removeClass("onEdit"); $(document.body).removeClass("onEdit");
if(callbacks.onView && typeof callbacks.onView === 'function') { if(callbacks.onView && typeof callbacks.onView === 'function') {
callbacks.onView(app); callbacks.onView(app);
@ -133,7 +137,10 @@ var Parameters = (function(){
else { else {
log("Set parameter value ["+value+"] for key : ["+key+"]"); log("Set parameter value ["+value+"] for key : ["+key+"]");
this.delegate.setPreference(key, value); this.delegate.setPreference(key, value);
this.container.trigger("preferenceChange", {key: key, value: value}); this.container.trigger("preferenceChange", {
key: key,
value: value
});
} }
} }
} }
@ -234,9 +241,39 @@ var App = (function() {
return doc; return doc;
} }
var file = stringToXML(e.dataTransfer.getData("text/plain")); var file = stringToXML(e.dataTransfer.getData("text/plain"));
var tmp_img = $("<img/>").attr("src", $(file).find("path:eq(0)").text());
var w = 0;
var h = 0;
$(this).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width()){
if(tmp_img.height() > 180){
h = 180;
tmp_img.attr("height",h);
w = tmp_img.width();
} else {
h = tmp_img.height();
w = tmp_img.width();
}
}
else{
if(tmp_img.width() > 180){
w = 180;
tmp_img.attr("width",w);
h = tmp_img.height();
} else {
h = tmp_img.height();
w = tmp_img.width();
}
}
callback({ callback({
src: $(file).find("path:eq(0)").text() src: $(file).find("path:eq(0)").text(),
width: w,
height: h
}); });
tmp_img.remove();
}, 6)
return false; return false;
} }

@ -195,5 +195,8 @@ $(document).ready(function(){
onEdit: reloadApp, onEdit: reloadApp,
onView: reloadApp onView: reloadApp
}; };
init(reloadCallback, {toolbar: toolbarTemplate, parameters: parametersTemplate}, callbacks); init(reloadCallback, {
toolbar: toolbarTemplate,
parameters: parametersTemplate
}, callbacks);
}); });
Loading…
Cancel
Save