Fix center properly ...

This commit is contained in:
Paulo Veiga 2011-08-28 10:58:41 -03:00
parent 26759bd437
commit c2521f0f9f
3 changed files with 18 additions and 9 deletions

View File

@ -99,16 +99,24 @@ mindplot.Workspace = new Class({
var coordHeight = zoom * this._screenHeight; var coordHeight = zoom * this._screenHeight;
workspace.setCoordSize(coordWidth, coordHeight); workspace.setCoordSize(coordWidth, coordHeight);
// View port coords ...
if (this._viewPort) {
this._viewPort.width = this._viewPort.width * zoom;
this._viewPort.height = this._viewPort.height * zoom;
}
// Center topic.... // Center topic....
var coordOriginX; var coordOriginX;
var coordOriginY; var coordOriginY;
if (center && this._viewPort) { if (center) {
coordOriginX = -(this._viewPort.width / 2); if (this._viewPort) {
coordOriginY = -(this._viewPort.height / 2); coordOriginX = -(this._viewPort.width / 2);
} else if (center) { coordOriginY = -(this._viewPort.height / 2);
coordOriginX = -(coordWidth / 2); } else {
coordOriginY = -(coordHeight / 2); coordOriginX = -(coordWidth / 2);
coordOriginY = -(coordHeight / 2);
}
} else { } else {
var coordOrigin = workspace.getCoordOrigin(); var coordOrigin = workspace.getCoordOrigin();
coordOriginX = coordOrigin.x; coordOriginX = coordOrigin.x;

View File

@ -23,6 +23,8 @@ web2d.peer.svg.WorkspacePeer = function(element)
web2d.peer.svg.ElementPeer.call(this, svgElement); web2d.peer.svg.ElementPeer.call(this, svgElement);
this._native.setAttribute("focusable", "true"); this._native.setAttribute("focusable", "true");
this._native.setAttribute("id", "workspace"); this._native.setAttribute("id", "workspace");
this._native.setAttribute("preserveAspectRatio", "true");
}; };
objects.extend(web2d.peer.svg.WorkspacePeer, web2d.peer.svg.ElementPeer); objects.extend(web2d.peer.svg.WorkspacePeer, web2d.peer.svg.ElementPeer);

View File

@ -196,7 +196,6 @@ function buildMindmapDesigner() {
// core.Monitor.setInstance(monitor); // core.Monitor.setInstance(monitor);
var container = $('mindplot'); var container = $('mindplot');
// container.setStyles();
container.setStyles({ container.setStyles({
height: parseInt(screen.height), height: parseInt(screen.height),
@ -205,8 +204,8 @@ function buildMindmapDesigner() {
designer = new mindplot.MindmapDesigner(editorProperties, container); designer = new mindplot.MindmapDesigner(editorProperties, container);
designer.setViewPort({ designer.setViewPort({
height: parseInt(window.innerHeight - 150), height: parseInt(window.innerHeight-112), // Footer and Header
width: parseInt(window.innerWidth - 200) width: parseInt(window.innerWidth)
}); });
if (mindplot.collaboration.CollaborationManager.getInstance().isCollaborationFrameworkAvailable()) { if (mindplot.collaboration.CollaborationManager.getInstance().isCollaborationFrameworkAvailable()) {