re-enabling drag and drop import

master
Mark MacKay 2012-10-25 20:30:58 -05:00
parent 81d984bf6f
commit 19b706bbfa
5 changed files with 944 additions and 942 deletions

View File

@ -3625,42 +3625,41 @@
//image handling //image handling
else { else {
alert("sorry, bitmap import is temporalily disabled") var reader = new FileReader();
//var reader = new FileReader(); reader.onloadend = function(e) {
//reader.onloadend = function(e) { // lets insert the new image until we know its dimensions
// // lets insert the new image until we know its dimensions insertNewImage = function(img_width, img_height){
// insertNewImage = function(img_width, img_height){ var newImage = svgCanvas.addSvgElementFromJson({
// var newImage = svgCanvas.addSvgElementFromJson({ "element": "image",
// "element": "image", "attr": {
// "attr": { "x": 0,
// "x": 0, "y": 0,
// "y": 0, "width": img_width,
// "width": img_width, "height": img_height,
// "height": img_height, "id": svgCanvas.getNextId(),
// "id": svgCanvas.getNextId(), "style": "pointer-events:inherit"
// "style": "pointer-events:inherit" }
// } });
// }); svgCanvas.setHref(newImage, e.target.result);
// svgCanvas.setHref(newImage, e.target.result); svgCanvas.selectOnly([newImage])
// svgCanvas.selectOnly([newImage]) svgCanvas.alignSelectedElements("m", "page")
// svgCanvas.alignSelectedElements("m", "page") svgCanvas.alignSelectedElements("c", "page")
// svgCanvas.alignSelectedElements("c", "page") updateContextPanel();
// updateContextPanel(); }
// } // put a placeholder img so we know the default dimensions
// // put a placeholder img so we know the default dimensions var img_width = 100;
// var img_width = 100; var img_height = 100;
// var img_height = 100; var img = new Image()
// var img = new Image() img.src = e.target.result
// img.src = e.target.result document.body.appendChild(img);
// document.body.appendChild(img); img.onload = function() {
// img.onload = function() { img_width = img.offsetWidth
// img_width = img.offsetWidth img_height = img.offsetHeight
// img_height = img.offsetHeight insertNewImage(img_width, img_height);
// insertNewImage(img_width, img_height); document.body.removeChild(img);
// document.body.removeChild(img); }
// } };
//}; reader.readAsDataURL(file)
//reader.readAsDataURL(file)
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -388,10 +388,12 @@
<label id="seg_type_label">Straight</label> <label id="seg_type_label">Straight</label>
</div> </div>
<!--
<label class="draginput checkbox" data-title="Link Control Points"> <label class="draginput checkbox" data-title="Link Control Points">
<span>Linked Control Points</span> <span>Linked Control Points</span>
<div class="push_bottom"><input type="checkbox" id="tool_node_link" checked="checked" /></div> <div class="push_bottom"><input type="checkbox" id="tool_node_link" checked="checked" /></div>
</label> </label>
-->
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="tool_button" id="tool_node_clone" title="Adds a node">Add Node</div> <div class="tool_button" id="tool_node_clone" title="Adds a node">Add Node</div>

View File

@ -3625,42 +3625,41 @@
//image handling //image handling
else { else {
alert("sorry, bitmap import is temporalily disabled") var reader = new FileReader();
//var reader = new FileReader(); reader.onloadend = function(e) {
//reader.onloadend = function(e) { // lets insert the new image until we know its dimensions
// // lets insert the new image until we know its dimensions insertNewImage = function(img_width, img_height){
// insertNewImage = function(img_width, img_height){ var newImage = svgCanvas.addSvgElementFromJson({
// var newImage = svgCanvas.addSvgElementFromJson({ "element": "image",
// "element": "image", "attr": {
// "attr": { "x": 0,
// "x": 0, "y": 0,
// "y": 0, "width": img_width,
// "width": img_width, "height": img_height,
// "height": img_height, "id": svgCanvas.getNextId(),
// "id": svgCanvas.getNextId(), "style": "pointer-events:inherit"
// "style": "pointer-events:inherit" }
// } });
// }); svgCanvas.setHref(newImage, e.target.result);
// svgCanvas.setHref(newImage, e.target.result); svgCanvas.selectOnly([newImage])
// svgCanvas.selectOnly([newImage]) svgCanvas.alignSelectedElements("m", "page")
// svgCanvas.alignSelectedElements("m", "page") svgCanvas.alignSelectedElements("c", "page")
// svgCanvas.alignSelectedElements("c", "page") updateContextPanel();
// updateContextPanel(); }
// } // put a placeholder img so we know the default dimensions
// // put a placeholder img so we know the default dimensions var img_width = 100;
// var img_width = 100; var img_height = 100;
// var img_height = 100; var img = new Image()
// var img = new Image() img.src = e.target.result
// img.src = e.target.result document.body.appendChild(img);
// document.body.appendChild(img); img.onload = function() {
// img.onload = function() { img_width = img.offsetWidth
// img_width = img.offsetWidth img_height = img.offsetHeight
// img_height = img.offsetHeight insertNewImage(img_width, img_height);
// insertNewImage(img_width, img_height); document.body.removeChild(img);
// document.body.removeChild(img); }
// } };
//}; reader.readAsDataURL(file)
//reader.readAsDataURL(file)
} }
} }
} }

File diff suppressed because it is too large Load Diff