mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Minor bug fixing.
This commit is contained in:
parent
1fefb929da
commit
f704e730c9
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
mindplot.MediaTopic = new Class({
|
||||
Extends:mindplot.Topic,
|
||||
initialize : function(model, options) {
|
||||
this.parent(model, options);
|
||||
},
|
||||
|
||||
getInnerShape : function() {
|
||||
if (!$defined(this._innerShape)) {
|
||||
// Create inner box.
|
||||
var model = this.getModel();
|
||||
|
||||
this._innerShape = new web2d.Image();
|
||||
this._innerShape.setHref(model.getImageUrl());
|
||||
this._innerShape.setPosition(0, 0);
|
||||
}
|
||||
return this._innerShape;
|
||||
},
|
||||
|
||||
getOuterShape : function() {
|
||||
if (!$defined(this._outerShape)) {
|
||||
var rect = new web2d.Rect(0, mindplot.Topic.OUTER_SHAPE_ATTRIBUTES);
|
||||
rect.setPosition(-2, -3);
|
||||
rect.setOpacity(0);
|
||||
this._outerShape = rect;
|
||||
}
|
||||
|
||||
return this._outerShape;
|
||||
},
|
||||
|
||||
|
||||
_buildShape : function() {
|
||||
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
|
||||
var group = new web2d.Group(groupAttributes);
|
||||
this._set2DElement(group);
|
||||
|
||||
// Shape must be build based on the model width ...
|
||||
var outerShape = this.getOuterShape();
|
||||
var innerShape = this.getInnerShape();
|
||||
var shrinkConnector = this.getShrinkConnector();
|
||||
|
||||
// Add to the group ...
|
||||
group.appendChild(outerShape);
|
||||
group.appendChild(innerShape);
|
||||
|
||||
// Update figure size ...
|
||||
// var model = this.getModel();
|
||||
// if (model.getLinks().length != 0 || model.getNotes().length != 0 || model.getIcons().length != 0) {
|
||||
// this.getOrBuildIconGroup();
|
||||
// }
|
||||
|
||||
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
shrinkConnector.addToWorkspace(group);
|
||||
}
|
||||
|
||||
// Register listeners ...
|
||||
this._registerDefaultListenersToElement(group, this);
|
||||
|
||||
|
||||
},
|
||||
|
||||
workoutOutgoingConnectionPoint : function(targetPosition) {
|
||||
$assert(targetPosition, 'targetPoint can not be null');
|
||||
var pos = this.getPosition();
|
||||
|
||||
var result;
|
||||
result = new core.Point();
|
||||
var groupPosition = this._elem2d.getPosition();
|
||||
var innerShareSize = this.getInnerShape().getSize();
|
||||
var isAtRight = mindplot.util.Shape.isAtRight(targetPosition, pos);
|
||||
|
||||
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, this.getSize(), isAtRight, true);
|
||||
return result;
|
||||
},
|
||||
|
||||
createDragNode : function(layoutManager) {
|
||||
var result = this.parent(layoutManager);
|
||||
|
||||
// Is the node already connected ?
|
||||
var targetTopic = this.getOutgoingConnectedTopic();
|
||||
if ($defined(targetTopic)) {
|
||||
result.connectTo(targetTopic);
|
||||
result.setVisibility(false);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
_adjustShapes : function() {
|
||||
if (this._isInWorkspace) {
|
||||
|
||||
var size = this.getModel().getSize();
|
||||
this.setSize(size, true);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize : function(oldSize, newSize) {
|
||||
|
||||
var xOffset = Math.round((newSize.width - oldSize.width) / 2);
|
||||
var pos = this.getPosition();
|
||||
if ($defined(pos)) {
|
||||
if (pos.x > 0) {
|
||||
pos.x = pos.x + xOffset;
|
||||
} else {
|
||||
pos.x = pos.x - xOffset;
|
||||
}
|
||||
this.setPosition(pos);
|
||||
}
|
||||
},
|
||||
|
||||
updateTopicShape : function() {
|
||||
// Todo: verify ...
|
||||
},
|
||||
|
||||
closeEditors : function() {
|
||||
//@Todo:
|
||||
}
|
||||
});
|
@ -68,7 +68,6 @@ mindplot.Topic = new Class({
|
||||
|
||||
setShapeType : function(type) {
|
||||
this._setShapeType(type, true);
|
||||
|
||||
},
|
||||
|
||||
getParent : function() {
|
||||
@ -164,8 +163,10 @@ mindplot.Topic = new Class({
|
||||
|
||||
if (type == mindplot.model.TopicShape.RECTANGLE) {
|
||||
result = new web2d.Rect(0, attributes);
|
||||
}else if(type == mindplot.model.TopicShape.IMAGE){
|
||||
throw "Must be implemented ...";
|
||||
}
|
||||
else if (type == mindplot.model.TopicShape.ELIPSE) {
|
||||
else if (type == mindplot.model.TopicShape.ELLIPSE) {
|
||||
result = new web2d.Rect(0.9, attributes);
|
||||
}
|
||||
else if (type == mindplot.model.TopicShape.ROUNDED_RECT) {
|
||||
|
@ -293,7 +293,7 @@ mindplot.model.TopicShape =
|
||||
{
|
||||
RECTANGLE : 'rectagle',
|
||||
ROUNDED_RECT : 'rounded rectagle',
|
||||
ELIPSE : 'elipse',
|
||||
ELLIPSE : 'elipse',
|
||||
LINE : 'line',
|
||||
IMAGE : 'image'
|
||||
};
|
||||
|
@ -42,7 +42,7 @@
|
||||
designer = buildDesigner(editorProperties);
|
||||
|
||||
var domDocument = core.Utils.createDocumentFromText(mapXml);
|
||||
var serializer = mindplot.persistence.MLSerializerFactory.getSerializerFromDocument(domDocument);
|
||||
var serializer = mindplot.persistence.XMLSerializerFactory.getSerializerFromDocument(domDocument);
|
||||
var mindmap = serializer.loadFromDom(domDocument, mapId);
|
||||
|
||||
// Now, load the map ...
|
||||
|
Loading…
Reference in New Issue
Block a user