Skip to content

Commit

Permalink
Merge branch 'hotfix-3.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rbudde committed Nov 29, 2019
2 parents 424dab9 + 6c2bd5c commit 69fab7f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
2 changes: 2 additions & 0 deletions OpenRobertaServer/staticResources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,8 @@ <h3 class="modal-title" lkey="Blockly.Msg.POPUP_DISPLAY_HEADER">Ausgabe deines P
</div>
<div class="hidden">
<input type="file" id="fileSelector" display="none"></input>
<input type="file" id="backgroundFileSelector" display="none"></input>

</div>
<div id="cookieDisclaimer" class="cookies-enabled hidden">
<span> <span lkey="Blockly.Msg.POPUP_STARTUP_COOKIES">We use cookies to personalise content and to analyse our traffic.</span> <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ define({

MAX_WIDTH: 2000,

MAX_HEIGHT: 1000,
MAX_HEIGHT: 820,

WAVE_LENGTH: 60
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

define(['exports', 'simulation.scene', 'simulation.math', 'program.controller', 'simulation.constants', 'util', 'program.controller',
'interpreter.interpreter', 'interpreter.robotMbedBehaviour', 'jquery'
'interpreter.interpreter', 'interpreter.robotMbedBehaviour', 'simulation.constants', 'jquery'
], function(exports, Scene, SIMATH, ROBERTA_PROGRAM, CONST, UTIL, PROGRAM_C,
SIM_I, MBED_R, $) {
SIM_I, MBED_R, C, $) {

var interpreters;
var scene;
Expand Down Expand Up @@ -861,38 +861,45 @@ define(['exports', 'simulation.scene', 'simulation.math', 'program.controller',
}

function importImage() {
var input = $(document.createElement('input'));
input.attr("type", "file");
input.attr("accept", ".png, .jpg, .jpeg, .svg");
input.trigger('click'); // opening dialog
input.change(function(event) {
$('#backgroundFileSelector').val(null);
$('#backgroundFileSelector').attr("accept", ".png, .jpg, .jpeg, .svg");
$('#backgroundFileSelector').trigger('click'); // opening dialog
$('#backgroundFileSelector').change(function(event) {
var file = event.target.files[0];
var reader = new FileReader();
reader.onload = function(event) {
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
var scale = 1;
if (img.height > 800) {
scale = 800.0 / img.height;
var scaleX = 1;
var scaleY = 1;
// - 20 because of the border pattern which is 10 pixels wide on both sides
if (img.width > C.MAX_WIDTH - 20) {
scaleX = (C.MAX_WIDTH - 20) / img.width;
}
if (img.height > C.MAX_HEIGHT - 20) {
scaleY = (C.MAX_HEIGHT - 20) / img.height;
}
var scale = Math.min(scaleX, scaleY);
canvas.width = img.width * scale;
canvas.height = img.height * scale;
var ctx = canvas.getContext("2d");
ctx.scale(scale, scale);
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
localStorage.setItem("customBackground", dataURL.replace(/^data:image\/(png|jpg);base64,/, ""));
var dataImage = localStorage.getItem('customBackground');
var image = new Image();
image.src = "data:image/png;base64," + dataImage;
imgObjectList[imgObjectList.length] = image;
setBackground(imgObjectList.length - 1, setBackground);
initScene();
var image = new Image(canvas.width, canvas.height);
image.src = dataURL;
image.onload = function() {
imgObjectList[imgObjectList.length] = image;
setBackground(imgObjectList.length - 1, setBackground);
initScene();
}
};
img.src = reader.result;
};
reader.readAsDataURL(file);
return false;
});
}
exports.importImage = importImage;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<inceptionYear>2014</inceptionYear>
<properties>
<!-- the server version history is a comma separated list of all versions INCLUDING the actual version. New to old (e.g. 2.1.0,2.0.0,1.9.9,1.9.7) -->
<openRobertaServer.history>3.7.0,3.6.1,3.6.0,3.5.2,3.5.1,3.5.0,3.4.1,3.4.0,3.3.1,3.3.0,3.2.1,3.2.0,3.1.1,3.1.0,3.0.3,3.0.2,3.0.1,3.0.0,2.8.1,2.8.0,2.7.1,2.7.0,2.6.2,2.6.1,2.6.0,2.5.5,2.5.4,2.5.3,2.5.2,2.5.1,2.5.0,2.4.1,2.4.0,2.3.4,2.3.3,2.3.2,2.3.1,2.3.0,2.2.7,2.2.6,2.2.5,2.2.4,2.2.3,2.2.2,2.2.1,2.2.0,2.1.0</openRobertaServer.history>
<openRobertaServer.history>3.7.1,3.7.0,3.6.1,3.6.0,3.5.2,3.5.1,3.5.0,3.4.1,3.4.0,3.3.1,3.3.0,3.2.1,3.2.0,3.1.1,3.1.0,3.0.3,3.0.2,3.0.1,3.0.0,2.8.1,2.8.0,2.7.1,2.7.0,2.6.2,2.6.1,2.6.0,2.5.5,2.5.4,2.5.3,2.5.2,2.5.1,2.5.0,2.4.1,2.4.0,2.3.4,2.3.3,2.3.2,2.3.1,2.3.0,2.2.7,2.2.6,2.2.5,2.2.4,2.2.3,2.2.2,2.2.1,2.2.0,2.1.0</openRobertaServer.history>
<!-- UNUSED functionality - the server SHOULD be compatible between(including) the following two versions of software deployed on the ROBOT -->
<validversionrange.From>1.4.0</validversionrange.From>
<validversionrange.To>2.6.0</validversionrange.To>
Expand Down

0 comments on commit 69fab7f

Please sign in to comment.