mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
- Remove getTopicType flag.
This commit is contained in:
parent
8a8922f2a6
commit
a0ee153ca0
@ -40,20 +40,11 @@ mindplot.CentralTopic = new Class({
|
||||
return 11;
|
||||
},
|
||||
|
||||
getTopicType:function () {
|
||||
return mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
},
|
||||
|
||||
setCursor:function (type) {
|
||||
type = (type == 'move') ? 'default' : type;
|
||||
this.parent(type);
|
||||
},
|
||||
|
||||
isConnectedToCentralTopic:function () {
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_defaultShapeType:function () {
|
||||
return mindplot.model.TopicShape.ROUNDED_RECT;
|
||||
},
|
||||
|
@ -116,7 +116,6 @@ mindplot.Designer = new Class({
|
||||
},
|
||||
|
||||
|
||||
|
||||
addEvent:function (type, listener) {
|
||||
if (type == mindplot.TopicEvent.EDIT || type == mindplot.TopicEvent.CLICK) {
|
||||
var editor = mindplot.TopicEventDispatcher.getInstance();
|
||||
@ -161,6 +160,48 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
// Register mouse drag and drop event ...
|
||||
function noopHandler(evt) {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
}
|
||||
|
||||
// Enable drag events ...
|
||||
Element.NativeEvents.dragenter = 2;
|
||||
Element.NativeEvents.dragexit = 2;
|
||||
Element.NativeEvents.dragover = 2;
|
||||
Element.NativeEvents.drop = 2;
|
||||
|
||||
screenManager.addEvent('dragenter', noopHandler);
|
||||
screenManager.addEvent('dragexit', noopHandler);
|
||||
screenManager.addEvent('dragover', noopHandler);
|
||||
screenManager.addEvent('drop', function (evt) {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
//
|
||||
var files = evt.event.dataTransfer.files;
|
||||
console.log(event);
|
||||
|
||||
var count = files.length;
|
||||
|
||||
// Only call the handler if 1 or more files was dropped.
|
||||
if (count > 0) {
|
||||
|
||||
var model = this.getMindmap().createNode();
|
||||
model.setImageSize(80, 43);
|
||||
model.setMetadata("{'media':'video,'url':'http://www.youtube.com/watch?v=P3FrXftyuzw&feature=g-vrec&context=G2b4ab69RVAAAAAAAAAA'}");
|
||||
model.setImageUrl("images/logo-small.png");
|
||||
model.setShapeType(mindplot.model.TopicShape.IMAGE);
|
||||
|
||||
var position = screenManager.getWorkspaceMousePosition(evt);
|
||||
model.setPosition(position.x, position.y);
|
||||
model.setPosition(100, 100);
|
||||
|
||||
this._actionDispatcher.addTopics([model]);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
|
||||
},
|
||||
|
||||
_buildDragManager:function (workspace) {
|
||||
@ -362,7 +403,7 @@ mindplot.Designer = new Class({
|
||||
|
||||
// Exclude central topic ..
|
||||
topics = topics.filter(function (topic) {
|
||||
return topic.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||
return !topic.isCentralTopic();
|
||||
});
|
||||
|
||||
this._clipboard = topics.map(function (topic) {
|
||||
@ -692,7 +733,7 @@ mindplot.Designer = new Class({
|
||||
},
|
||||
|
||||
_removeTopic:function (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
var parent = node._parent;
|
||||
node.disconnect(this._workspace);
|
||||
|
||||
@ -722,14 +763,14 @@ mindplot.Designer = new Class({
|
||||
// If there are more than one node selected,
|
||||
$notify($msg('ENTITIES_COULD_NOT_BE_DELETED'));
|
||||
return;
|
||||
} else if (topics.length == 1 && topics[0].getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
} else if (topics.length == 1 && topics[0].isCentralTopic()) {
|
||||
$notify($msg('CENTRAL_TOPIC_CAN_NOT_BE_DELETED'));
|
||||
return;
|
||||
}
|
||||
|
||||
// If the central topic has been selected, I must filter ir
|
||||
var topicIds = topics.filter(function (topic) {
|
||||
return topic.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE
|
||||
return !topic.isCentralTopic();
|
||||
}).map(function (topic) {
|
||||
return topic.getId()
|
||||
});
|
||||
|
@ -228,7 +228,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
'right':function () {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (node.isCentralTopic()) {
|
||||
this._goToSideChild(designer, node, 'RIGHT');
|
||||
}
|
||||
else {
|
||||
@ -248,7 +248,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
'left':function () {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (node.isCentralTopic()) {
|
||||
this._goToSideChild(designer, node, 'LEFT');
|
||||
}
|
||||
else {
|
||||
@ -268,7 +268,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
'up':function () {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
this._goToBrother(designer, node, 'UP');
|
||||
}
|
||||
} else {
|
||||
@ -280,7 +280,7 @@ mindplot.DesignerKeyboard = new Class({
|
||||
'down':function () {
|
||||
var node = model.selectedTopic();
|
||||
if (node) {
|
||||
if (node.getTopicType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
if (!node.isCentralTopic()) {
|
||||
this._goToBrother(designer, node, 'DOWN');
|
||||
}
|
||||
} else {
|
||||
|
@ -88,10 +88,6 @@ mindplot.MainTopic = new Class({
|
||||
innerShape.setVisibility(true);
|
||||
},
|
||||
|
||||
getTopicType:function () {
|
||||
return "MainTopic";
|
||||
},
|
||||
|
||||
_updatePositionOnChangeSize:function (oldSize, newSize) {
|
||||
|
||||
var xOffset = Math.round((newSize.width - oldSize.width) / 2);
|
||||
@ -181,13 +177,6 @@ mindplot.MainTopic = new Class({
|
||||
return result;
|
||||
},
|
||||
|
||||
isConnectedToCentralTopic:function () {
|
||||
var model = this.getModel();
|
||||
var parent = model.getParent();
|
||||
|
||||
return parent && parent.getType() === mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
},
|
||||
|
||||
_defaultText:function () {
|
||||
var targetTopic = this.getOutgoingConnectedTopic();
|
||||
var result = "";
|
||||
@ -199,7 +188,6 @@ mindplot.MainTopic = new Class({
|
||||
}
|
||||
} else {
|
||||
result = $msg('ISOLATED_TOPIC');
|
||||
;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
@ -1216,7 +1216,13 @@ mindplot.Topic = new Class({
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
isCentralTopic:function () {
|
||||
return this.getModel().getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user