mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-23 03:43:48 +01:00
removing .bind mootools call (phase 1/2)
This commit is contained in:
parent
fb5546111e
commit
fe59b1ce46
@ -29,30 +29,26 @@ mindplot.ControlPoint = new Class({
|
||||
new web2d.Line({strokeColor:"#6589de", strokeWidth:1, opacity:0.3})];
|
||||
|
||||
this._isBinded = false;
|
||||
var me = this;
|
||||
this._controlPointsController[0].addEvent('mousedown', function(event) {
|
||||
(this._mouseDown.bind(this))(event, mindplot.ControlPoint.FROM);
|
||||
}.bind(this));
|
||||
(me._mouseDown)(event, mindplot.ControlPoint.FROM, me);
|
||||
});
|
||||
this._controlPointsController[0].addEvent('click', function(event) {
|
||||
(this._mouseClick.bind(this))(event);
|
||||
}.bind(this));
|
||||
(me._mouseClick)(event);
|
||||
});
|
||||
this._controlPointsController[0].addEvent('dblclick', function(event) {
|
||||
(this._mouseClick.bind(this))(event);
|
||||
}.bind(this));
|
||||
(me._mouseClick)(event);
|
||||
});
|
||||
|
||||
this._controlPointsController[1].addEvent('mousedown', function(event) {
|
||||
(this._mouseDown.bind(this))(event, mindplot.ControlPoint.TO);
|
||||
}.bind(this));
|
||||
(me._mouseDown)(event, mindplot.ControlPoint.TO, me);
|
||||
});
|
||||
this._controlPointsController[1].addEvent('click', function(event) {
|
||||
(this._mouseClick.bind(this))(event);
|
||||
}.bind(this));
|
||||
(me._mouseClick)(event);
|
||||
});
|
||||
this._controlPointsController[1].addEvent('dblclick', function(event) {
|
||||
(this._mouseClick.bind(this))(event);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
||||
setSide : function(side) {
|
||||
this._side = side;
|
||||
(me._mouseClick)(event);
|
||||
});
|
||||
},
|
||||
|
||||
setLine : function(line) {
|
||||
@ -91,18 +87,17 @@ mindplot.ControlPoint = new Class({
|
||||
|
||||
},
|
||||
|
||||
_mouseDown : function(event, point) {
|
||||
_mouseDown : function(event, point, me) {
|
||||
if (!this._isBinded) {
|
||||
this._isBinded = true;
|
||||
|
||||
this._mouseMoveFunction = function(event) {
|
||||
(this._mouseMoveEvent.bind(this))(event, point);
|
||||
}.bind(this);
|
||||
(me._mouseMoveEvent)(event, point, me);
|
||||
};
|
||||
|
||||
this._workspace.getScreenManager().addEvent('mousemove', this._mouseMoveFunction);
|
||||
this._mouseUpFunction = function(event) {
|
||||
(this._mouseUp.bind(this))(event, point);
|
||||
}.bind(this);
|
||||
(me._mouseUp)(event, point, me);
|
||||
};
|
||||
this._workspace.getScreenManager().addEvent('mouseup', this._mouseUpFunction);
|
||||
}
|
||||
event.preventDefault();
|
||||
|
@ -35,9 +35,10 @@ mindplot.Designer = new Class({
|
||||
var commandContext = new mindplot.CommandContext(this);
|
||||
this._actionDispatcher = new mindplot.StandaloneActionDispatcher(commandContext);
|
||||
|
||||
var me = this;
|
||||
this._actionDispatcher.addEvent("modelUpdate", function (event) {
|
||||
this.fireEvent("modelUpdate", event);
|
||||
}.bind(this));
|
||||
me.fireEvent("modelUpdate", event);
|
||||
});
|
||||
|
||||
mindplot.ActionDispatcher.setInstance(this._actionDispatcher);
|
||||
this._model = new mindplot.DesignerModel(options);
|
||||
@ -130,37 +131,34 @@ mindplot.Designer = new Class({
|
||||
_registerMouseEvents:function () {
|
||||
var workspace = this._workspace;
|
||||
var screenManager = workspace.getScreenManager();
|
||||
|
||||
var me = this;
|
||||
// Initialize workspace event listeners.
|
||||
screenManager.addEvent('update', function () {
|
||||
// Topic must be set to his original state. All editors must be closed.
|
||||
var topics = this.getModel().getTopics();
|
||||
var topics = me.getModel().getTopics();
|
||||
_.each(topics, function(object){
|
||||
object.closeEditors();
|
||||
});
|
||||
|
||||
// Clean some selected nodes on event ..
|
||||
if (this._cleanScreen)
|
||||
this._cleanScreen();
|
||||
|
||||
}.bind(this));
|
||||
if (me._cleanScreen)
|
||||
me._cleanScreen();
|
||||
});
|
||||
|
||||
// Deselect on click ...
|
||||
screenManager.addEvent('click', function (event) {
|
||||
this.onObjectFocusEvent(null, event);
|
||||
}.bind(this));
|
||||
me.onObjectFocusEvent(null, event);
|
||||
});
|
||||
|
||||
// Create nodes on double click...
|
||||
screenManager.addEvent('dblclick', function (event) {
|
||||
if (workspace.isWorkspaceEventsEnabled()) {
|
||||
|
||||
var mousePos = screenManager.getWorkspaceMousePosition(event);
|
||||
|
||||
var centralTopic = this.getModel().getCentralTopic();
|
||||
var model = this._createChildModel(centralTopic, mousePos);
|
||||
var centralTopic = me.getModel().getCentralTopic();
|
||||
var model = me._createChildModel(centralTopic, mousePos);
|
||||
this._actionDispatcher.addTopics([model], [centralTopic.getId()]);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Register mouse drag and drop event ...
|
||||
function noopHandler(evt) {
|
||||
@ -254,13 +252,13 @@ mindplot.Designer = new Class({
|
||||
// Create node graph ...
|
||||
var topic = mindplot.NodeGraph.create(model, {readOnly:readOnly});
|
||||
this.getModel().addTopic(topic);
|
||||
|
||||
var me = this;
|
||||
// Add Topic events ...
|
||||
if (!readOnly) {
|
||||
// If a node had gained focus, clean the rest of the nodes ...
|
||||
topic.addEvent('mousedown', function (event) {
|
||||
this.onObjectFocusEvent(topic, event);
|
||||
}.bind(this));
|
||||
me.onObjectFocusEvent(topic, event);
|
||||
});
|
||||
|
||||
// Register node listeners ...
|
||||
if (topic.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
|
||||
@ -292,24 +290,24 @@ mindplot.Designer = new Class({
|
||||
}
|
||||
|
||||
topic.addEvent('ontblur', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
var topics = me.getModel().filterSelectedTopics();
|
||||
var rels = me.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 0 || rels.length == 0) {
|
||||
this.fireEvent('onblur');
|
||||
me.fireEvent('onblur');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
topic.addEvent('ontfocus', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
var topics = me.getModel().filterSelectedTopics();
|
||||
var rels = me.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 1 || rels.length == 1) {
|
||||
this.fireEvent('onfocus');
|
||||
me.fireEvent('onfocus');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
return topic;
|
||||
return topic;
|
||||
},
|
||||
|
||||
onObjectFocusEvent:function (currentObject, event) {
|
||||
@ -630,12 +628,13 @@ mindplot.Designer = new Class({
|
||||
// Init layout manager ...
|
||||
var size = {width:25, height:25};
|
||||
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
|
||||
var me = this;
|
||||
layoutManager.addEvent('change', function (event) {
|
||||
var id = event.getId();
|
||||
var topic = this.getModel().findTopicById(id);
|
||||
var topic = me.getModel().findTopicById(id);
|
||||
topic.setPosition(event.getPosition());
|
||||
topic.setOrder(event.getOrder());
|
||||
}.bind(this));
|
||||
});
|
||||
this._eventBussDispatcher.setLayoutManager(layoutManager);
|
||||
|
||||
|
||||
@ -753,24 +752,25 @@ mindplot.Designer = new Class({
|
||||
|
||||
// Build relationship line ....
|
||||
var result = new mindplot.Relationship(sourceTopic, targetTopic, model);
|
||||
var me = this;
|
||||
|
||||
result.addEvent('ontblur', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
var topics = me.getModel().filterSelectedTopics();
|
||||
var rels = me.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 0 || rels.length == 0) {
|
||||
this.fireEvent('onblur');
|
||||
me.fireEvent('onblur');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
result.addEvent('ontfocus', function () {
|
||||
var topics = this.getModel().filterSelectedTopics();
|
||||
var rels = this.getModel().filterSelectedRelationships();
|
||||
var topics = me.getModel().filterSelectedTopics();
|
||||
var rels = me.getModel().filterSelectedRelationships();
|
||||
|
||||
if (topics.length == 1 || rels.length == 1) {
|
||||
this.fireEvent('onfocus');
|
||||
me.fireEvent('onfocus');
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Append it to the workspace ...
|
||||
dmodel.addRelationship(result);
|
||||
|
@ -84,15 +84,16 @@ mindplot.DragConnector = new Class({
|
||||
// - Horizontal proximity
|
||||
// - It's already connected.
|
||||
var currentConnection = dragTopic.getConnectedToTopic();
|
||||
var me = this;
|
||||
topics = topics.sort(function (a, b) {
|
||||
var aPos = a.getPosition();
|
||||
var bPos = b.getPosition();
|
||||
|
||||
var av = this._isVerticallyAligned(a.getSize(), aPos, sPos);
|
||||
var bv = this._isVerticallyAligned(b.getSize(), bPos, sPos);
|
||||
return this._proximityWeight(av, a, sPos, currentConnection) - this._proximityWeight(bv, b, sPos, currentConnection);
|
||||
var av = me._isVerticallyAligned(a.getSize(), aPos, sPos);
|
||||
var bv = me._isVerticallyAligned(b.getSize(), bPos, sPos);
|
||||
return me._proximityWeight(av, a, sPos, currentConnection) - me._proximityWeight(bv, b, sPos, currentConnection);
|
||||
|
||||
}.bind(this));
|
||||
});
|
||||
return topics;
|
||||
},
|
||||
|
||||
|
@ -31,14 +31,14 @@ mindplot.DragManager = new Class({
|
||||
var workspace = this._workspace;
|
||||
var screen = workspace.getScreenManager();
|
||||
var dragManager = this;
|
||||
|
||||
var me = this;
|
||||
var mouseDownListener = function(event) {
|
||||
if (workspace.isWorkspaceEventsEnabled()) {
|
||||
// Disable double drag...
|
||||
workspace.enableWorkspaceEvents(false);
|
||||
|
||||
// Set initial position.
|
||||
var layoutManager = this._eventDispatcher.getLayoutManager();
|
||||
var layoutManager = me._eventDispatcher.getLayoutManager();
|
||||
var dragNode = node.createDragNode(layoutManager);
|
||||
|
||||
// Register mouse move listener ...
|
||||
@ -52,7 +52,7 @@ mindplot.DragManager = new Class({
|
||||
// Change cursor.
|
||||
window.document.body.style.cursor = 'move';
|
||||
}
|
||||
}.bind(this);
|
||||
};
|
||||
node.addEvent('mousedown', mouseDownListener);
|
||||
},
|
||||
|
||||
@ -70,10 +70,10 @@ mindplot.DragManager = new Class({
|
||||
|
||||
_buildMouseMoveListener : function(workspace, dragNode, dragManager) {
|
||||
var screen = workspace.getScreenManager();
|
||||
|
||||
var me = this;
|
||||
var result = function(event) {
|
||||
|
||||
if (!this._isDragInProcess) {
|
||||
if (!me._isDragInProcess) {
|
||||
// Execute Listeners ..
|
||||
var startDragListener = dragManager._listeners['startdragging'];
|
||||
startDragListener(event, dragNode);
|
||||
@ -81,7 +81,7 @@ mindplot.DragManager = new Class({
|
||||
// Add shadow node to the workspace.
|
||||
workspace.append(dragNode);
|
||||
|
||||
this._isDragInProcess = true;
|
||||
me._isDragInProcess = true;
|
||||
}
|
||||
|
||||
var pos = screen.getWorkspaceMousePosition(event);
|
||||
@ -95,13 +95,14 @@ mindplot.DragManager = new Class({
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
}.bind(this);
|
||||
};
|
||||
dragManager._mouseMoveListener = result;
|
||||
return result;
|
||||
},
|
||||
|
||||
_buildMouseUpListener : function(workspace, node, dragNode, dragManager) {
|
||||
var screen = workspace.getScreenManager();
|
||||
var me = this;
|
||||
var result = function(event) {
|
||||
$assert(dragNode.isDragTopic, 'dragNode must be an DragTopic');
|
||||
|
||||
@ -117,7 +118,7 @@ mindplot.DragManager = new Class({
|
||||
// Change the cursor to the default.
|
||||
window.document.body.style.cursor = 'default';
|
||||
|
||||
if (this._isDragInProcess) {
|
||||
if (me._isDragInProcess) {
|
||||
|
||||
// Execute Listeners only if the node has been moved.
|
||||
var endDragListener = dragManager._listeners['enddragging'];
|
||||
@ -126,11 +127,11 @@ mindplot.DragManager = new Class({
|
||||
// Remove drag node from the workspace.
|
||||
dragNode.removeFromWorkspace(workspace);
|
||||
|
||||
this._isDragInProcess = false;
|
||||
me._isDragInProcess = false;
|
||||
}
|
||||
|
||||
|
||||
}.bind(this);
|
||||
};
|
||||
dragManager._mouseUpListener = result;
|
||||
return result;
|
||||
},
|
||||
|
@ -101,11 +101,11 @@ mindplot.IconGroup = new Class({
|
||||
|
||||
this._icons.erase(icon);
|
||||
this._resize(this._icons.length);
|
||||
|
||||
var me = this;
|
||||
// Add all again ...
|
||||
_.each(this._icons, function (elem, i) {
|
||||
this._positionIcon(elem, i);
|
||||
}.bind(this));
|
||||
me._positionIcon(elem, i);
|
||||
});
|
||||
},
|
||||
|
||||
moveToFront:function () {
|
||||
|
@ -29,19 +29,20 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
|
||||
execute:function (commandContext) {
|
||||
|
||||
var me = this;
|
||||
_.each(this._models, function (model, index) {
|
||||
|
||||
// Add a new topic ...
|
||||
var topic = commandContext.createTopic(model);
|
||||
|
||||
// Connect to topic ...
|
||||
if (this._parentsIds) {
|
||||
var parentId = this._parentsIds[index];
|
||||
if (me._parentsIds) {
|
||||
var parentId = me._parentsIds[index];
|
||||
if ($defined(parentId)) {
|
||||
var parentTopic = commandContext.findTopics(parentId)[0];
|
||||
commandContext.connect(topic, parentTopic);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
commandContext.addTopic(topic);
|
||||
}
|
||||
|
||||
@ -53,7 +54,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
// Render node ...
|
||||
topic.setVisibility(true);
|
||||
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
undoExecute:function (commandContext) {
|
||||
@ -69,7 +70,7 @@ mindplot.commands.AddTopicCommand = new Class({
|
||||
var topicId = model.getId();
|
||||
var topic = commandContext.findTopics(topicId)[0];
|
||||
commandContext.deleteTopic(topic);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this._models = clonedModel;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ mindplot.commands.DeleteCommand = new Class({
|
||||
// Add rebuild relationships ...
|
||||
_.each(this._deletedRelModel, function (model) {
|
||||
commandContext.addRelationship(model);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Finally display the topics ...
|
||||
_.each(this._deletedTopicModels, function (topicModel) {
|
||||
|
@ -46,10 +46,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
}
|
||||
|
||||
if (topics != null) {
|
||||
var me = this;
|
||||
_.each(topics, function (topic) {
|
||||
var oldValue = this._commandFunc(topic, this._value);
|
||||
this._oldValues.push(oldValue);
|
||||
}.bind(this));
|
||||
var oldValue = me._commandFunc(topic, me._value);
|
||||
me._oldValues.push(oldValue);
|
||||
});
|
||||
}
|
||||
this.applied = true;
|
||||
|
||||
@ -62,10 +63,11 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
||||
undoExecute:function (commandContext) {
|
||||
if (this.applied) {
|
||||
var topics = commandContext.findTopics(this._topicsId);
|
||||
var me = this;
|
||||
_.each(topics, function (topic, index) {
|
||||
this._commandFunc(topic, this._oldValues[index]);
|
||||
me._commandFunc(topic, me._oldValues[index]);
|
||||
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.applied = false;
|
||||
this._oldValues = [];
|
||||
|
@ -26,9 +26,13 @@ mindplot.layout.GridSorter = new Class({
|
||||
var children = this._getSortedChildren(treeSet, node);
|
||||
|
||||
// Compute heights ...
|
||||
var me = this;
|
||||
var heights = children.map(function(child) {
|
||||
return {id:child.getId(),height:this._computeChildrenHeight(treeSet, child)};
|
||||
}.bind(this));
|
||||
return {
|
||||
id: child.getId(),
|
||||
height: me._computeChildrenHeight(treeSet, child)
|
||||
};
|
||||
});
|
||||
|
||||
// Calculate the offsets ...
|
||||
var result = {};
|
||||
|
@ -107,12 +107,12 @@ mindplot.layout.OriginalLayout = new Class({
|
||||
var sorter = node.getSorter();
|
||||
var offsetById = sorter.computeOffsets(this._treeSet, node);
|
||||
var parentPosition = node.getPosition();
|
||||
|
||||
var me = this;
|
||||
_.each(children, function (child) {
|
||||
var offset = offsetById[child.getId()];
|
||||
|
||||
var childFreeDisplacement = child.getFreeDisplacement();
|
||||
var direction = node.getSorter().getChildDirection(this._treeSet, child);
|
||||
var direction = node.getSorter().getChildDirection(me._treeSet, child);
|
||||
|
||||
if ((direction > 0 && childFreeDisplacement.x < 0) || (direction < 0 && childFreeDisplacement.x > 0)) {
|
||||
child.resetFreeDisplacement();
|
||||
@ -125,9 +125,9 @@ mindplot.layout.OriginalLayout = new Class({
|
||||
var parentX = parentPosition.x;
|
||||
var parentY = parentPosition.y;
|
||||
|
||||
var newPos = {x:parentX + offset.x, y:parentY + offset.y + this._calculateAlignOffset(node, child, heightById)};
|
||||
this._treeSet.updateBranchPosition(child, newPos);
|
||||
}.bind(this));
|
||||
var newPos = {x:parentX + offset.x, y:parentY + offset.y + me._calculateAlignOffset(node, child, heightById)};
|
||||
me._treeSet.updateBranchPosition(child, newPos);
|
||||
});
|
||||
|
||||
node._branchHeight = newBranchHeight;
|
||||
}
|
||||
|
@ -240,9 +240,10 @@ mindplot.layout.RootedTreeSet = new Class({
|
||||
var yOffset = oldPos.y - position.y;
|
||||
|
||||
var children = this.getChildren(node);
|
||||
var me = this;
|
||||
_.each(children, function (child) {
|
||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
||||
}.bind(this));
|
||||
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
@ -251,9 +252,10 @@ mindplot.layout.RootedTreeSet = new Class({
|
||||
node.setPosition({x:position.x + xOffset, y:position.y + yOffset});
|
||||
|
||||
var children = this.getChildren(node);
|
||||
var me = this;
|
||||
_.each(children, function (child) {
|
||||
this.shiftBranchPosition(child, xOffset, yOffset);
|
||||
}.bind(this));
|
||||
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||
});
|
||||
},
|
||||
|
||||
getSiblingsInVerticalDirection:function (node, yOffset) {
|
||||
|
@ -286,7 +286,7 @@ mindplot.model.INodeModel = new Class({
|
||||
result = result + key + ":" + value + ",";
|
||||
});
|
||||
result = result + "}"
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
result = result + ' }';
|
||||
|
@ -32,9 +32,10 @@ mindplot.persistence.Beta2PelaMigrator = new Class({
|
||||
|
||||
// Beta does not set position on second level nodes ...
|
||||
var branches = mindmap.getBranches();
|
||||
var me = this;
|
||||
_.each(branches, function (model) {
|
||||
this._fixPosition(model);
|
||||
}.bind(this));
|
||||
me._fixPosition(model);
|
||||
});
|
||||
|
||||
return mindmap;
|
||||
},
|
||||
@ -42,11 +43,12 @@ mindplot.persistence.Beta2PelaMigrator = new Class({
|
||||
_fixPosition:function (parentModel) {
|
||||
var parentPos = parentModel.getPosition();
|
||||
var isRight = parentPos.x > 0;
|
||||
var me = this;
|
||||
_.each(parentModel.getChildren(), function (child) {
|
||||
if (!child.getPosition()) {
|
||||
child.setPosition(parentPos.x + (50 * isRight ? 1 : -1), parentPos.y);
|
||||
}
|
||||
this._fixPosition(child);
|
||||
}.bind(this));
|
||||
me._fixPosition(child);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -27,11 +27,11 @@ mindplot.widget.IMenu = new Class({
|
||||
this._containerId = containerId;
|
||||
this._mapId = mapId;
|
||||
this._mindmapUpdated = false;
|
||||
|
||||
var me = this;
|
||||
// Register update events ...
|
||||
this._designer.addEvent('modelUpdate', function () {
|
||||
this.setRequireChange(true);
|
||||
}.bind(this));
|
||||
me.setRequireChange(true);
|
||||
});
|
||||
},
|
||||
|
||||
clear:function () {
|
||||
|
@ -55,9 +55,9 @@ mindplot.widget.IconPanel = new Class({
|
||||
var panel = this;
|
||||
var model = this.getModel();
|
||||
img.on('click', function (event) {
|
||||
model.setValue(this.attr('id'));
|
||||
model.setValue($(this).attr('id'));
|
||||
panel.hide();
|
||||
}.bind(img));
|
||||
});
|
||||
|
||||
count = count + 1;
|
||||
}
|
||||
|
@ -22,15 +22,11 @@ mindplot.widget.ToolbarPaneItem = new Class({
|
||||
$assert(buttonId, "buttonId can not be null");
|
||||
$assert(model, "model can not be null");
|
||||
this._model = model;
|
||||
var me = this;
|
||||
var fn = function() {
|
||||
// Is the panel being displayed ?
|
||||
if (this.isVisible()) {
|
||||
this.hide();
|
||||
} else {
|
||||
this.show();
|
||||
}
|
||||
|
||||
}.bind(this);
|
||||
me.isVisible() ? me.hide() : me.show();
|
||||
};
|
||||
this.parent(buttonId, fn, {topicAction:true,relAction:false});
|
||||
this._panelElem = this._init();
|
||||
this._visible = false;
|
||||
|
@ -48,14 +48,16 @@ web2d.peer.svg.TextPeer = new Class({
|
||||
this._text = text;
|
||||
if (text) {
|
||||
var lines = text.split('\n');
|
||||
var me = this;
|
||||
//FIXME: we could use underscorejs here
|
||||
lines.forEach(function (line) {
|
||||
var tspan = window.document.createElementNS(this.svgNamespace, 'tspan');
|
||||
var tspan = window.document.createElementNS(me.svgNamespace, 'tspan');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
tspan.setAttribute('x', this.getPosition().x);
|
||||
tspan.setAttribute('x', me.getPosition().x);
|
||||
|
||||
tspan.textContent = line.length == 0 ? " " : line;
|
||||
this._native.appendChild(tspan);
|
||||
}.bind(this));
|
||||
me._native.appendChild(tspan);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user