Made scrolling area smaller, set color for outside image area
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1226 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
8c3488ab31
commit
292fa28398
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#svg_editor #svgcanvas {
|
#svg_editor #svgcanvas {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: #FFFFFF;
|
background-color: #A0A0A0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
width: 640px;
|
width: 640px;
|
||||||
|
|
|
@ -251,7 +251,7 @@ function svg_edit_setup() {
|
||||||
var bb = z_info.bbox;
|
var bb = z_info.bbox;
|
||||||
$('#zoom').val(Math.round(zoomlevel*100));
|
$('#zoom').val(Math.round(zoomlevel*100));
|
||||||
// setResolution(res.w * zoomlevel, res.h * zoomlevel);
|
// setResolution(res.w * zoomlevel, res.h * zoomlevel);
|
||||||
var scrLeft = bb.x * zoomlevel;
|
var scrLeft = bb.x * zoomlevel + $("svgcanvas").width()/2;
|
||||||
var scrOffX = w_area.width()/2 - (bb.width * zoomlevel)/2;
|
var scrOffX = w_area.width()/2 - (bb.width * zoomlevel)/2;
|
||||||
w_area[0].scrollLeft = Math.max(0,scrLeft - scrOffX) + Math.max(0,canvas_pos.left);
|
w_area[0].scrollLeft = Math.max(0,scrLeft - scrOffX) + Math.max(0,canvas_pos.left);
|
||||||
var scrTop = bb.y * zoomlevel;
|
var scrTop = bb.y * zoomlevel;
|
||||||
|
@ -1280,7 +1280,10 @@ function svg_edit_setup() {
|
||||||
if(color == curPrefs.bg_color && url == curPrefs.bg_url) return;
|
if(color == curPrefs.bg_color && url == curPrefs.bg_url) return;
|
||||||
$.pref('bg_color', color);
|
$.pref('bg_color', color);
|
||||||
$.pref('bg_url', url);
|
$.pref('bg_url', url);
|
||||||
$('#svgcanvas').css('background',color);
|
|
||||||
|
// This should be done in svgcanvas.js for the borderRect fill
|
||||||
|
// $('#svgcanvas').css('background',color);
|
||||||
|
|
||||||
if(url) {
|
if(url) {
|
||||||
if(!$('#background_img').length) {
|
if(!$('#background_img').length) {
|
||||||
$('<div id="background_img"><img src="'+url+'" style="width:100%"></div>')
|
$('<div id="background_img"><img src="'+url+'" style="width:100%"></div>')
|
||||||
|
@ -2324,11 +2327,11 @@ function svg_edit_setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var updateCanvas = function() {
|
var updateCanvas = function(center) {
|
||||||
var w = workarea.width(), h = workarea.height();
|
var w = workarea.width(), h = workarea.height();
|
||||||
var w_orig = w, h_orig = h;
|
var w_orig = w, h_orig = h;
|
||||||
var zoom = svgCanvas.getZoom();
|
var zoom = svgCanvas.getZoom();
|
||||||
var multi = (5*(zoom>1?zoom:1));
|
var multi = (3*(zoom>1?zoom:1));
|
||||||
// Make the canvas bigger than the viewport
|
// Make the canvas bigger than the viewport
|
||||||
w *= multi;
|
w *= multi;
|
||||||
h *= multi;
|
h *= multi;
|
||||||
|
@ -2336,15 +2339,19 @@ function svg_edit_setup() {
|
||||||
$("#svgcanvas").width(w).height(h);
|
$("#svgcanvas").width(w).height(h);
|
||||||
svgCanvas.updateCanvas(w, h);
|
svgCanvas.updateCanvas(w, h);
|
||||||
|
|
||||||
var w_area = workarea;
|
// if(center) {
|
||||||
var scroll_y = h/2 - h_orig/2;
|
var w_area = workarea;
|
||||||
var scroll_x = w/2 - w_orig/2;
|
var scroll_y = h/2 - h_orig/2;
|
||||||
w_area[0].scrollTop = scroll_y;
|
var scroll_x = w/2 - w_orig/2;
|
||||||
w_area[0].scrollLeft = scroll_x;
|
w_area[0].scrollTop = scroll_y;
|
||||||
|
w_area[0].scrollLeft = scroll_x;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// set starting resolution (centers canvas)
|
// set starting resolution (centers canvas)
|
||||||
// setResolution(640,480);
|
// setResolution(640,480);
|
||||||
$(updateCanvas);
|
$(function() {
|
||||||
|
updateCanvas(true);
|
||||||
|
});
|
||||||
|
|
||||||
// var revnums = "svg-editor.js ($Rev$) ";
|
// var revnums = "svg-editor.js ($Rev$) ";
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
|
|
|
@ -573,10 +573,10 @@ function BatchCommand(text) {
|
||||||
'y':'0',
|
'y':'0',
|
||||||
'stroke-width':'1',
|
'stroke-width':'1',
|
||||||
'stroke':'#000',
|
'stroke':'#000',
|
||||||
'fill':'none',
|
'fill':'#FFF',
|
||||||
'style':'pointer-events:none'
|
'style':'pointer-events:none'
|
||||||
});
|
});
|
||||||
mgr.selectorParentGroup.appendChild(rect);
|
svgroot.insertBefore(rect, svgcontent);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.requestSelector = function(elem) {
|
this.requestSelector = function(elem) {
|
||||||
|
@ -6375,7 +6375,9 @@ function BatchCommand(text) {
|
||||||
|
|
||||||
assignAttributes(rect, {
|
assignAttributes(rect, {
|
||||||
width: svgcontent.getAttribute('width') * current_zoom,
|
width: svgcontent.getAttribute('width') * current_zoom,
|
||||||
height: svgcontent.getAttribute('height') * current_zoom
|
height: svgcontent.getAttribute('height') * current_zoom,
|
||||||
|
x: x,
|
||||||
|
y: y
|
||||||
});
|
});
|
||||||
|
|
||||||
selectorManager.selectorParentGroup.setAttribute("transform","translate(" + x + "," + y + ")");
|
selectorManager.selectorParentGroup.setAttribute("transform","translate(" + x + "," + y + ")");
|
||||||
|
|
Loading…
Reference in New Issue