mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-25 23:54:55 +01:00
Remove underscore library
This commit is contained in:
parent
e07c13631c
commit
aecf0864f5
@ -17,7 +17,6 @@
|
||||
*/
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import $ from '@libraries/jquery-2.1.0';
|
||||
import _ from '@libraries/underscore-min';
|
||||
|
||||
import Events from './Events';
|
||||
import Messages from './Messages';
|
||||
@ -146,7 +145,7 @@ class Designer extends Events {
|
||||
screenManager.addEvent('update', () => {
|
||||
// Topic must be set to his original state. All editors must be closed.
|
||||
const topics = me.getModel().getTopics();
|
||||
_.each(topics, (object) => {
|
||||
topics.forEach((object) => {
|
||||
object.closeEditors();
|
||||
});
|
||||
|
||||
@ -304,13 +303,13 @@ class Designer extends Events {
|
||||
onObjectFocusEvent(currentObject, event) {
|
||||
// Close node editors ..
|
||||
const topics = this.getModel().getTopics();
|
||||
_.each(topics, (topic) => {
|
||||
topics.forEach((topic) => {
|
||||
topic.closeEditors();
|
||||
});
|
||||
|
||||
const model = this.getModel();
|
||||
const objects = model.getEntities();
|
||||
_.each(objects, (object) => {
|
||||
objects.forEach((object) => {
|
||||
// Disable all nodes on focus but not the current if Ctrl key isn't being pressed
|
||||
if (!$defined(event) || (!event.ctrlKey && !event.metaKey)) {
|
||||
if (object.isOnFocus() && object !== currentObject) {
|
||||
@ -324,7 +323,7 @@ class Designer extends Events {
|
||||
selectAll() {
|
||||
const model = this.getModel();
|
||||
const objects = model.getEntities();
|
||||
_.each(objects, (object) => {
|
||||
objects.forEach((object) => {
|
||||
object.setOnFocus(true);
|
||||
});
|
||||
}
|
||||
@ -332,7 +331,7 @@ class Designer extends Events {
|
||||
/** removes focus from all model entities, i.e. relationships and topics */
|
||||
deselectAll() {
|
||||
const objects = this.getModel().getEntities();
|
||||
_.each(objects, (object) => {
|
||||
objects.forEach((object) => {
|
||||
object.setOnFocus(false);
|
||||
});
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
|
||||
class Events {
|
||||
constructor() {
|
||||
@ -38,15 +37,16 @@ class Events {
|
||||
type = Events._removeOn(type);
|
||||
const events = this.$events[type];
|
||||
if (!events) return this;
|
||||
|
||||
args = Array.isArray(args) ? args : [args];
|
||||
_.each(
|
||||
events,
|
||||
function (fn) {
|
||||
if (delay) fn.delay(delay, this, args);
|
||||
else fn.apply(this, args);
|
||||
},
|
||||
this,
|
||||
);
|
||||
events.forEach(((fn) => {
|
||||
if (delay) {
|
||||
fn.delay(delay, this, args);
|
||||
}
|
||||
else {
|
||||
fn.apply(this, args);
|
||||
}
|
||||
}).bind(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -100,16 +100,14 @@ const IconGroup = new Class(
|
||||
|
||||
_findIconFromModel(iconModel) {
|
||||
let result = null;
|
||||
_.each(
|
||||
this._icons,
|
||||
(icon) => {
|
||||
const elModel = icon.getModel();
|
||||
if (elModel.getId() == iconModel.getId()) {
|
||||
result = icon;
|
||||
}
|
||||
},
|
||||
this,
|
||||
);
|
||||
|
||||
this._icons.forEach((icon) => {
|
||||
const elModel = icon.getModel();
|
||||
|
||||
if (elModel.getId() === iconModel.getId()) {
|
||||
result = icon;
|
||||
}
|
||||
});
|
||||
|
||||
if (result == null) {
|
||||
throw new Error(`Icon can no be found:${iconModel.getId()}, Icons:${this._icons}`);
|
||||
@ -135,8 +133,9 @@ const IconGroup = new Class(
|
||||
this._icons.erase(icon);
|
||||
this._resize(this._icons.length);
|
||||
const me = this;
|
||||
|
||||
// Add all again ...
|
||||
_.each(this._icons, (elem, i) => {
|
||||
this._icons.forEach((elem, i) => {
|
||||
me._positionIcon(elem, i);
|
||||
});
|
||||
},
|
||||
|
@ -70,7 +70,7 @@ class RelationshipPivot {
|
||||
// Register focus events on all topics ...
|
||||
const model = this._designer.getModel();
|
||||
const topics = model.getTopics();
|
||||
_.each(topics, (topic) => {
|
||||
topics.forEach((topic) => {
|
||||
topic.addEvent('ontfocus', this._onTopicClick);
|
||||
});
|
||||
}
|
||||
@ -85,10 +85,10 @@ class RelationshipPivot {
|
||||
|
||||
const model = this._designer.getModel();
|
||||
const topics = model.getTopics();
|
||||
const me = this;
|
||||
_.each(topics, (topic) => {
|
||||
topic.removeEvent('ontfocus', me._onTopicClick);
|
||||
});
|
||||
|
||||
topics.forEach(((topic) => {
|
||||
topic.removeEvent('ontfocus', this._onTopicClick);
|
||||
}).bind(this));
|
||||
|
||||
workspace.removeChild(this._pivot);
|
||||
workspace.removeChild(this._startArrow);
|
||||
|
@ -56,7 +56,7 @@ class ScreenManager {
|
||||
|
||||
fireEvent(type, event) {
|
||||
if (type === 'click') {
|
||||
_.each(this._clickEvents, (listener) => {
|
||||
this._clickEvents.forEach((listener) => {
|
||||
listener(type, event);
|
||||
});
|
||||
} else {
|
||||
|
@ -16,7 +16,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import { _ } from '@libraries/underscore-min';
|
||||
import * as web2d from '@wisemapping/web2d';
|
||||
|
||||
import NodeGraph from './NodeGraph';
|
||||
@ -961,7 +960,7 @@ class Topic extends NodeGraph {
|
||||
}
|
||||
|
||||
_setRelationshipLinesVisibility(value) {
|
||||
_.each(this._relationships, (relationship) => {
|
||||
this._relationships.forEach((relationship) => {
|
||||
const sourceTopic = relationship.getSourceTopic();
|
||||
const targetTopic = relationship.getTargetTopic();
|
||||
|
||||
|
@ -41,7 +41,7 @@ class AddTopicCommand extends Command {
|
||||
*/
|
||||
execute(commandContext) {
|
||||
const me = this;
|
||||
_.each(this._models, (model, index) => {
|
||||
this._models.forEach((model, index) => {
|
||||
// Add a new topic ...
|
||||
const topic = commandContext.createTopic(model);
|
||||
|
||||
@ -73,12 +73,12 @@ class AddTopicCommand extends Command {
|
||||
undoExecute(commandContext) {
|
||||
// Delete disconnected the nodes. Create a copy of the topics ...
|
||||
const clonedModel = [];
|
||||
_.each(this._models, (model) => {
|
||||
this._models.forEach((model) => {
|
||||
clonedModel.push(model.clone());
|
||||
});
|
||||
|
||||
// Finally, remove the nodes ...
|
||||
_.each(this._models, (model) => {
|
||||
this._models.forEach((model) => {
|
||||
const topicId = model.getId();
|
||||
const topic = commandContext.findTopics(topicId)[0];
|
||||
commandContext.deleteTopic(topic);
|
||||
|
@ -44,7 +44,7 @@ class DeleteCommand extends Command {
|
||||
const topics = this._filterChildren(this._topicIds, commandContext);
|
||||
|
||||
if (topics.length > 0) {
|
||||
_.each(topics, function (topic) {
|
||||
topics.forEach(((topic) => {
|
||||
// In case that it's editing text node, force close without update ...
|
||||
topic.closeEditors();
|
||||
|
||||
@ -54,7 +54,7 @@ class DeleteCommand extends Command {
|
||||
const relationships = this._collectInDepthRelationships(topic);
|
||||
this._deletedRelModel.append(relationships.map((rel) => rel.getModel().clone()));
|
||||
|
||||
_.each(relationships, (relationship) => {
|
||||
relationships.forEach((relationship) => {
|
||||
commandContext.deleteRelationship(relationship);
|
||||
});
|
||||
|
||||
@ -70,15 +70,15 @@ class DeleteCommand extends Command {
|
||||
|
||||
// Finally, delete the topic from the workspace...
|
||||
commandContext.deleteTopic(topic);
|
||||
}, this);
|
||||
}));
|
||||
}
|
||||
|
||||
const rels = commandContext.findRelationships(this._relIds);
|
||||
if (rels.length > 0) {
|
||||
_.each(rels, function (rel) {
|
||||
rels.forEach(((rel) => {
|
||||
this._deletedRelModel.push(rel.getModel().clone());
|
||||
commandContext.deleteRelationship(rel);
|
||||
}, this);
|
||||
}).bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,12 +88,12 @@ class DeleteCommand extends Command {
|
||||
*/
|
||||
undoExecute(commandContext) {
|
||||
// Add all the topics ...
|
||||
_.each(this._deletedTopicModels, (model) => {
|
||||
this._deletedTopicModels.forEach((model) => {
|
||||
commandContext.createTopic(model);
|
||||
}, this);
|
||||
});
|
||||
|
||||
// Do they need to be connected ?
|
||||
_.each(this._deletedTopicModels, function (topicModel, index) {
|
||||
this._deletedTopicModels.forEach(((topicModel, index) => {
|
||||
const topics = commandContext.findTopics(topicModel.getId());
|
||||
|
||||
const parentId = this._parentTopicIds[index];
|
||||
@ -101,18 +101,18 @@ class DeleteCommand extends Command {
|
||||
const parentTopics = commandContext.findTopics(parentId);
|
||||
commandContext.connect(topics[0], parentTopics[0]);
|
||||
}
|
||||
}, this);
|
||||
}).bind(this));
|
||||
|
||||
// Add rebuild relationships ...
|
||||
_.each(this._deletedRelModel, (model) => {
|
||||
this._deletedRelModel.forEach((model) => {
|
||||
commandContext.addRelationship(model);
|
||||
});
|
||||
|
||||
// Finally display the topics ...
|
||||
_.each(this._deletedTopicModels, (topicModel) => {
|
||||
this._deletedTopicModels.forEach((topicModel) => {
|
||||
const topics = commandContext.findTopics(topicModel.getId());
|
||||
topics[0].setBranchVisibility(true);
|
||||
}, this);
|
||||
});
|
||||
|
||||
// Focus on last recovered topic ..
|
||||
if (this._deletedTopicModels.length > 0) {
|
||||
@ -130,7 +130,7 @@ class DeleteCommand extends Command {
|
||||
const topics = commandContext.findTopics(topicIds);
|
||||
|
||||
const result = [];
|
||||
_.each(topics, (topic) => {
|
||||
topics.forEach((topic) => {
|
||||
let parent = topic.getParent();
|
||||
let found = false;
|
||||
while (parent != null && !found) {
|
||||
@ -172,7 +172,6 @@ class DeleteCommand extends Command {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default DeleteCommand;
|
||||
|
@ -16,7 +16,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { $defined, $assert } from '@wisemapping/core-js';
|
||||
import _ from '@libraries/underscore-min';
|
||||
import Command from '../Command';
|
||||
|
||||
class GenericFunctionCommand extends Command {
|
||||
@ -62,14 +61,14 @@ class GenericFunctionCommand extends Command {
|
||||
|
||||
if (topics != null) {
|
||||
const me = this;
|
||||
_.each(topics, (topic) => {
|
||||
topics.forEach((topic) => {
|
||||
const oldValue = me._commandFunc(topic, me._value);
|
||||
me._oldValues.push(oldValue);
|
||||
});
|
||||
}
|
||||
this.applied = true;
|
||||
} else {
|
||||
throw 'Command can not be applied two times in a row.';
|
||||
throw new Error('Command can not be applied two times in a row.');
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,10 +79,10 @@ class GenericFunctionCommand extends Command {
|
||||
undoExecute(commandContext) {
|
||||
if (this.applied) {
|
||||
const topics = commandContext.findTopics(this._topicsId);
|
||||
const me = this;
|
||||
_.each(topics, (topic, index) => {
|
||||
me._commandFunc(topic, me._oldValues[index]);
|
||||
});
|
||||
|
||||
topics.forEach( ((topic, index) => {
|
||||
this._commandFunc(topic, this._oldValues[index]);
|
||||
}).bind(this));
|
||||
|
||||
this.applied = false;
|
||||
this._oldValues = [];
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import ChildrenSorterStrategy from './ChildrenSorterStrategy';
|
||||
|
||||
/**
|
||||
@ -50,13 +49,10 @@ const AbstractBasicSorter = new Class(
|
||||
result = height;
|
||||
} else {
|
||||
let childrenHeight = 0;
|
||||
_.each(
|
||||
children,
|
||||
function (child) {
|
||||
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
||||
},
|
||||
this,
|
||||
);
|
||||
|
||||
children.forEach(((child) => {
|
||||
childrenHeight += this._computeChildrenHeight(treeSet, child, heightCache);
|
||||
}));
|
||||
|
||||
result = Math.max(height, childrenHeight);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import AbstractBasicSorter from './AbstractBasicSorter';
|
||||
|
||||
@ -26,7 +25,7 @@ const BalancedSorter = new Class(
|
||||
* @constructs
|
||||
* @extends mindplot.layout.AbstractBasicSorter
|
||||
*/
|
||||
initialize() {},
|
||||
initialize() { },
|
||||
|
||||
/**
|
||||
* @param {} graph
|
||||
@ -52,10 +51,10 @@ const BalancedSorter = new Class(
|
||||
);
|
||||
|
||||
const limitXPos = parent.getPosition().x
|
||||
+ direction
|
||||
* (parent.getSize().width / 2
|
||||
+ node.getSize().width / 2
|
||||
+ BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
+ direction
|
||||
* (parent.getSize().width / 2
|
||||
+ node.getSize().width / 2
|
||||
+ BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
|
||||
const xPos = direction > 0
|
||||
? position.x >= limitXPos
|
||||
@ -112,10 +111,10 @@ const BalancedSorter = new Class(
|
||||
order,
|
||||
{
|
||||
x:
|
||||
parent.getPosition().x
|
||||
+ direction
|
||||
* (parent.getSize().width / 2
|
||||
+ BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2),
|
||||
parent.getPosition().x
|
||||
+ direction
|
||||
* (parent.getSize().width / 2
|
||||
+ BalancedSorter.INTERNODE_HORIZONTAL_PADDING * 2),
|
||||
y: parent.getPosition().y,
|
||||
},
|
||||
];
|
||||
@ -125,7 +124,7 @@ const BalancedSorter = new Class(
|
||||
let result = null;
|
||||
const last = children.getLast();
|
||||
position = position || { x: last.getPosition().x, y: last.getPosition().y + 1 };
|
||||
_.each(children, (child, index) => {
|
||||
children.forEach((child, index) => {
|
||||
const cpos = child.getPosition();
|
||||
if (position.y > cpos.y) {
|
||||
const yOffset = child == last
|
||||
@ -143,9 +142,9 @@ const BalancedSorter = new Class(
|
||||
{
|
||||
x: first.getPosition().x,
|
||||
y:
|
||||
first.getPosition().y
|
||||
- first.getSize().height
|
||||
- BalancedSorter.INTERNODE_VERTICAL_PADDING * 2,
|
||||
first.getPosition().y
|
||||
- first.getSize().height
|
||||
- BalancedSorter.INTERNODE_VERTICAL_PADDING * 2,
|
||||
},
|
||||
];
|
||||
}
|
||||
@ -193,7 +192,7 @@ const BalancedSorter = new Class(
|
||||
// Filter nodes on one side..
|
||||
const children = this._getChildrenForOrder(parent, treeSet, node.getOrder());
|
||||
|
||||
_.each(children, (child, index) => {
|
||||
children.forEach((child) => {
|
||||
if (child.getOrder() > node.getOrder()) {
|
||||
child.setOrder(child.getOrder() - 2);
|
||||
}
|
||||
@ -228,8 +227,8 @@ const BalancedSorter = new Class(
|
||||
let totalPHeight = 0;
|
||||
let totalNHeight = 0;
|
||||
|
||||
_.each(heights, (elem) => {
|
||||
if (elem.order % 2 == 0) {
|
||||
heights.forEach((elem) => {
|
||||
if (elem.order % 2 === 0) {
|
||||
totalPHeight += elem.height;
|
||||
} else {
|
||||
totalNHeight += elem.height;
|
||||
@ -254,9 +253,9 @@ const BalancedSorter = new Class(
|
||||
|
||||
const yOffset = ysum + heights[i].height / 2;
|
||||
const xOffset = direction
|
||||
* (node.getSize().width / 2
|
||||
+ heights[i].width / 2
|
||||
+ +BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
* (node.getSize().width / 2
|
||||
+ heights[i].width / 2
|
||||
+ +BalancedSorter.INTERNODE_HORIZONTAL_PADDING);
|
||||
|
||||
$assert(!isNaN(xOffset), 'xOffset can not be null');
|
||||
$assert(!isNaN(yOffset), 'yOffset can not be null');
|
||||
@ -282,12 +281,9 @@ const BalancedSorter = new Class(
|
||||
const order = i == 0 && factor == 1 ? 1 : factor * i;
|
||||
$assert(
|
||||
children[i].getOrder() == order,
|
||||
`Missing order elements. Missing order: ${
|
||||
i * factor
|
||||
}. Parent:${
|
||||
node.getId()
|
||||
},Node:${
|
||||
children[i].getId()}`,
|
||||
`Missing order elements. Missing order: ${i * factor
|
||||
}. Parent:${node.getId()
|
||||
},Node:${children[i].getId()}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import $ from '@libraries/jquery-2.1.0';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import Events from '../Events';
|
||||
@ -238,45 +237,37 @@ class LayoutManager extends Events {
|
||||
}
|
||||
|
||||
_flushEvents() {
|
||||
_.each(
|
||||
this._events,
|
||||
function (event) {
|
||||
this.fireEvent('change', event);
|
||||
},
|
||||
this,
|
||||
);
|
||||
this._events.forEach(((event) => {
|
||||
this.fireEvent('change', event);
|
||||
}));
|
||||
this._events = [];
|
||||
}
|
||||
|
||||
_collectChanges(nodes) {
|
||||
if (!nodes) {
|
||||
nodes = this._treeSet.getTreeRoots();
|
||||
if (!nodes) {
|
||||
nodes = this._treeSet.getTreeRoots();
|
||||
}
|
||||
|
||||
_.each(
|
||||
nodes,
|
||||
function (node) {
|
||||
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
||||
// Find or create a event ...
|
||||
const id = node.getId();
|
||||
let event = this._events.some((event) => event.id == id);
|
||||
if (!event) {
|
||||
event = new ChangeEvent(id);
|
||||
}
|
||||
|
||||
// Update nodes ...
|
||||
event.setOrder(node.getOrder());
|
||||
event.setPosition(node.getPosition());
|
||||
|
||||
node.resetPositionState();
|
||||
node.resetOrderState();
|
||||
node.resetFreeState();
|
||||
this._events.push(event);
|
||||
nodes.forEach(((node) => {
|
||||
if (node.hasOrderChanged() || node.hasPositionChanged()) {
|
||||
// Find or create a event ...
|
||||
const id = node.getId();
|
||||
let event = this._events.some((e) => e.id === id);
|
||||
if (!event) {
|
||||
event = new ChangeEvent(id);
|
||||
}
|
||||
this._collectChanges(this._treeSet.getChildren(node));
|
||||
},
|
||||
this,
|
||||
);
|
||||
|
||||
// Update nodes ...
|
||||
event.setOrder(node.getOrder());
|
||||
event.setPosition(node.getPosition());
|
||||
|
||||
node.resetPositionState();
|
||||
node.resetOrderState();
|
||||
node.resetFreeState();
|
||||
this._events.push(event);
|
||||
}
|
||||
this._collectChanges(this._treeSet.getChildren(node));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import Node from './Node';
|
||||
import SymmetricSorter from './SymmetricSorter';
|
||||
@ -27,6 +26,7 @@ class OriginalLayout {
|
||||
}
|
||||
|
||||
/** */
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
createNode(id, size, position, type) {
|
||||
$assert($defined(id), 'id can not be null');
|
||||
$assert(size, 'size can not be null');
|
||||
@ -77,20 +77,15 @@ class OriginalLayout {
|
||||
/** */
|
||||
layout() {
|
||||
const roots = this._treeSet.getTreeRoots();
|
||||
_.each(
|
||||
roots,
|
||||
function (node) {
|
||||
// Calculate all node heights ...
|
||||
const sorter = node.getSorter();
|
||||
roots.each(((node) => {
|
||||
// Calculate all node heights ...
|
||||
const sorter = node.getSorter();
|
||||
|
||||
const heightById = sorter.computeChildrenIdByHeights(this._treeSet, node);
|
||||
const heightById = sorter.computeChildrenIdByHeights(this._treeSet, node);
|
||||
this._layoutChildren(node, heightById);
|
||||
|
||||
this._layoutChildren(node, heightById);
|
||||
|
||||
this._fixOverlapping(node, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
this._fixOverlapping(node, heightById);
|
||||
}));
|
||||
}
|
||||
|
||||
_layoutChildren(node, heightById) {
|
||||
@ -113,7 +108,8 @@ class OriginalLayout {
|
||||
const offsetById = sorter.computeOffsets(this._treeSet, node);
|
||||
const parentPosition = node.getPosition();
|
||||
const me = this;
|
||||
_.each(children, (child) => {
|
||||
|
||||
children.each((child) => {
|
||||
const offset = offsetById[child.getId()];
|
||||
|
||||
const childFreeDisplacement = child.getFreeDisplacement();
|
||||
@ -147,13 +143,9 @@ class OriginalLayout {
|
||||
}
|
||||
|
||||
// Continue reordering the children nodes ...
|
||||
_.each(
|
||||
children,
|
||||
function (child) {
|
||||
this._layoutChildren(child, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
children.each(((child) => {
|
||||
this._layoutChildren(child, heightById);
|
||||
}));
|
||||
}
|
||||
|
||||
_calculateAlignOffset(node, child, heightById) {
|
||||
@ -168,7 +160,7 @@ class OriginalLayout {
|
||||
|
||||
if (
|
||||
this._treeSet.isStartOfSubBranch(child)
|
||||
&& this._branchIsTaller(child, heightById)
|
||||
&& OriginalLayout._branchIsTaller(child, heightById)
|
||||
) {
|
||||
if (this._treeSet.hasSinglePathToSingleLeaf(child)) {
|
||||
offset = heightById[child.getId()] / 2
|
||||
@ -193,7 +185,7 @@ class OriginalLayout {
|
||||
return offset;
|
||||
}
|
||||
|
||||
_branchIsTaller(node, heightById) {
|
||||
static _branchIsTaller(node, heightById) {
|
||||
return (
|
||||
heightById[node.getId()]
|
||||
> node.getSize().height + node.getSorter()._getVerticalPadding() * 2
|
||||
@ -206,14 +198,9 @@ class OriginalLayout {
|
||||
if (node.isFree()) {
|
||||
this._shiftBranches(node, heightById);
|
||||
}
|
||||
|
||||
_.each(
|
||||
children,
|
||||
function (child) {
|
||||
this._fixOverlapping(child, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
children.each(((child) => {
|
||||
this._fixOverlapping(child, heightById);
|
||||
}));
|
||||
}
|
||||
|
||||
_shiftBranches(node, heightById) {
|
||||
@ -223,40 +210,31 @@ class OriginalLayout {
|
||||
node,
|
||||
node.getFreeDisplacement().y,
|
||||
);
|
||||
let last = node;
|
||||
_.each(
|
||||
siblingsToShift,
|
||||
function (sibling) {
|
||||
const overlappingOccurs = shiftedBranches.some(function (shiftedBranch) {
|
||||
return this._branchesOverlap(shiftedBranch, sibling, heightById);
|
||||
}, this);
|
||||
|
||||
if (!sibling.isFree() || overlappingOccurs) {
|
||||
const sAmount = node.getFreeDisplacement().y;
|
||||
this._treeSet.shiftBranchPosition(sibling, 0, sAmount);
|
||||
shiftedBranches.push(sibling);
|
||||
}
|
||||
},
|
||||
this,
|
||||
);
|
||||
siblingsToShift.each(((sibling) => {
|
||||
const overlappingOccurs = shiftedBranches.some(((shiftedBranch) =>{
|
||||
return OriginalLayout._branchesOverlap(shiftedBranch, sibling, heightById);
|
||||
}).bind(this));
|
||||
|
||||
if (!sibling.isFree() || overlappingOccurs) {
|
||||
const sAmount = node.getFreeDisplacement().y;
|
||||
this._treeSet.shiftBranchPosition(sibling, 0, sAmount);
|
||||
shiftedBranches.push(sibling);
|
||||
}
|
||||
}).bind(this));
|
||||
|
||||
const branchesToShift = this._treeSet
|
||||
.getBranchesInVerticalDirection(node, node.getFreeDisplacement().y)
|
||||
.filter((branch) => !shiftedBranches.contains(branch));
|
||||
|
||||
_.each(
|
||||
branchesToShift,
|
||||
function (branch) {
|
||||
const bAmount = node.getFreeDisplacement().y;
|
||||
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
||||
shiftedBranches.push(branch);
|
||||
last = branch;
|
||||
},
|
||||
this,
|
||||
);
|
||||
branchesToShift.each(((branch) =>{
|
||||
const bAmount = node.getFreeDisplacement().y;
|
||||
this._treeSet.shiftBranchPosition(branch, 0, bAmount);
|
||||
shiftedBranches.push(branch);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
_branchesOverlap(branchA, branchB, heightById) {
|
||||
static _branchesOverlap(branchA, branchB, heightById) {
|
||||
// a branch doesn't really overlap with itself
|
||||
if (branchA === branchB) {
|
||||
return false;
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
|
||||
const RootedTreeSet = new Class(
|
||||
@ -376,7 +375,7 @@ const RootedTreeSet = new Class(
|
||||
|
||||
const children = this.getChildren(node);
|
||||
const me = this;
|
||||
_.each(children, (child) => {
|
||||
children.forEach( (child) => {
|
||||
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||
});
|
||||
},
|
||||
@ -392,7 +391,7 @@ const RootedTreeSet = new Class(
|
||||
|
||||
const children = this.getChildren(node);
|
||||
const me = this;
|
||||
_.each(children, (child) => {
|
||||
children.forEach((child) => {
|
||||
me.shiftBranchPosition(child, xOffset, yOffset);
|
||||
});
|
||||
},
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import AbstractBasicSorter from './AbstractBasicSorter';
|
||||
|
||||
@ -248,7 +247,7 @@ const SymmetricSorter = new Class(
|
||||
|
||||
// Compute the center of the branch ...
|
||||
let totalHeight = 0;
|
||||
_.each(heights, (elem) => {
|
||||
heights.forEach((elem) => {
|
||||
totalHeight += elem.height;
|
||||
});
|
||||
let ysum = totalHeight / 2;
|
||||
|
@ -12,10 +12,10 @@ class BootstrapDialogRequest extends BootstrapDialog {
|
||||
console.log(xhr);
|
||||
};
|
||||
|
||||
this.requestOptions.success = function () {
|
||||
this.requestOptions.success = function success() {
|
||||
// Intercept form requests ...
|
||||
const forms = me._native.find('form');
|
||||
_.each(forms, (form) => {
|
||||
forms.forEach((form) => {
|
||||
$(form).on('submit', (event) => {
|
||||
// Intercept form ...
|
||||
me.requestOptions.url = form.action;
|
||||
|
@ -163,7 +163,7 @@ class IMindmap {
|
||||
|
||||
// Then the rest of the branches ...
|
||||
const sbranchs = source.getBranches();
|
||||
_.each(sbranchs, (snode) => {
|
||||
sbranchs.forEach((snode) => {
|
||||
const tnode = target.createNode(snode.getType(), snode.getId());
|
||||
snode.copyTo(tnode);
|
||||
target.addBranch(tnode);
|
||||
|
@ -17,7 +17,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import _ from '../../../../../libraries/underscore-min';
|
||||
|
||||
class INodeModel {
|
||||
constructor(mindmap) {
|
||||
@ -273,7 +272,7 @@ class INodeModel {
|
||||
const source = this;
|
||||
// Copy properties ...
|
||||
const keys = source.getPropertiesKeys();
|
||||
_.each(keys, (key) => {
|
||||
keys.forEach((key) => {
|
||||
const value = source.getProperty(key);
|
||||
target.putProperty(key, value);
|
||||
});
|
||||
@ -282,7 +281,7 @@ class INodeModel {
|
||||
const children = this.getChildren();
|
||||
const tmindmap = target.getMindmap();
|
||||
|
||||
_.each((children, snode) => {
|
||||
children.forEach((snode) => {
|
||||
const tnode = tmindmap.createNode(snode.getType(), snode.getId());
|
||||
snode.copyTo(tnode);
|
||||
target.append(tnode);
|
||||
@ -347,10 +346,10 @@ class INodeModel {
|
||||
const children = this.getChildren();
|
||||
if (children.length > 0) {
|
||||
result = `${result}, children: {(size:${children.length}`;
|
||||
_.each(children, (node) => {
|
||||
children.forEach((node) => {
|
||||
result = `${result}=> (`;
|
||||
const keys = node.getPropertiesKeys();
|
||||
_.each(keys, (key) => {
|
||||
keys.forEach((key) => {
|
||||
const value = node.getProperty(key);
|
||||
result = `${result + key}:${value},`;
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ class Beta2PelaMigrator {
|
||||
// Beta does not set position on second level nodes ...
|
||||
const branches = mindmap.getBranches();
|
||||
const me = this;
|
||||
_.each(branches, (model) => {
|
||||
branches.forEach((model) => {
|
||||
me._fixPosition(model);
|
||||
});
|
||||
|
||||
@ -47,7 +47,7 @@ class Beta2PelaMigrator {
|
||||
const parentPos = parentModel.getPosition();
|
||||
const isRight = parentPos.x > 0;
|
||||
const me = this;
|
||||
_.each(parentModel.getChildren(), (child) => {
|
||||
parentModel.getChildren().forEach((child) => {
|
||||
if (!child.getPosition()) {
|
||||
child.setPosition(parentPos.x + (50 * isRight ? 1 : -1), parentPos.y);
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import _ from '@libraries/underscore-min';
|
||||
|
||||
// FIXME: this Class should be reimplemented
|
||||
import Events from '../Events';
|
||||
@ -36,7 +35,7 @@ const FadeEffect = new Class(/** @lends FadeEffect */{
|
||||
/** */
|
||||
start() {
|
||||
const visible = this._isVisible;
|
||||
_.each(this._element, (elem) => {
|
||||
this._element.forEach((elem) => {
|
||||
if (elem) {
|
||||
elem.setVisibility(visible);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import $ from '@libraries/jquery-2.1.0';
|
||||
import _ from '@libraries/underscore-min';
|
||||
import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import ToolbarPaneItem from './ToolbarPaneItem';
|
||||
|
||||
@ -65,7 +64,7 @@ class ColorPalettePanel extends ToolbarPaneItem {
|
||||
const colorCells = content.find('div[class=palette-colorswatch]');
|
||||
const model = this.getModel();
|
||||
const me = this;
|
||||
_.each(colorCells, (elem) => {
|
||||
colorCells.each((elem) => {
|
||||
$(elem).on('click', () => {
|
||||
const color = $(elem).css('background-color');
|
||||
model.setValue(color);
|
||||
@ -88,7 +87,7 @@ class ColorPalettePanel extends ToolbarPaneItem {
|
||||
const colorCells = panelElem.find('div[class=palette-colorswatch]');
|
||||
const model = this.getModel();
|
||||
let modelValue = model.getValue();
|
||||
_.each(colorCells, (elem) => {
|
||||
colorCells.forEach((elem) => {
|
||||
const color = $(elem).css('background-color').rgbToHex();
|
||||
if (modelValue != null && modelValue[0] === 'r') {
|
||||
modelValue = modelValue.rgbToHex();
|
||||
|
@ -37,7 +37,7 @@ class IMenu {
|
||||
}
|
||||
|
||||
clear() {
|
||||
_.each(this._toolbarElems, (item) => {
|
||||
this._toolbarElems.forEach((item) => {
|
||||
item.hide();
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class ListToolbarPanel extends ToolbarPaneItem {
|
||||
_initPanel() {
|
||||
// Register on toolbar elements ...
|
||||
const me = this;
|
||||
this.getPanelElem().children('div').bind('click', function (event) {
|
||||
this.getPanelElem().children('div').bind('click', function click(event) {
|
||||
event.stopPropagation();
|
||||
me.hide();
|
||||
const value = $defined($(this).attr('model')) ? $(this).attr('model') : $(this).attr('id');
|
||||
@ -38,7 +38,7 @@ class ListToolbarPanel extends ToolbarPaneItem {
|
||||
const panelElem = this.getPanelElem();
|
||||
const menuElems = panelElem.find('div');
|
||||
const value = this.getModel().getValue();
|
||||
_.each(menuElems, (elem) => {
|
||||
menuElems.forEach((elem) => {
|
||||
const elemValue = $defined($(elem).attr('model')) ? $(elem).attr('model') : $(elem).attr('id');
|
||||
$assert(elemValue, 'elemValue can not be null');
|
||||
if (elemValue === value) $(elem).attr('class', 'toolbarPanelLinkSelectedLink');
|
||||
|
@ -16,7 +16,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import $ from '@libraries/jquery-2.1.0';
|
||||
import _ from '@libraries/underscore-min';
|
||||
|
||||
import { $defined } from '@wisemapping/core-js';
|
||||
import BootstrapDialogRequest from "../libraries/bootstrap/BootstrapDialogRequest";
|
||||
@ -412,7 +411,7 @@ class Menu extends IMenu {
|
||||
_registerEvents(designer) {
|
||||
const me = this;
|
||||
// Register on close events ...
|
||||
_.each(this._toolbarElems, (elem) => {
|
||||
this._toolbarElems.forEach((elem) => {
|
||||
elem.addEvent('show', () => {
|
||||
me.clear();
|
||||
});
|
||||
@ -422,12 +421,12 @@ class Menu extends IMenu {
|
||||
const topics = designer.getModel().filterSelectedTopics();
|
||||
const rels = designer.getModel().filterSelectedRelationships();
|
||||
|
||||
_.each(me._toolbarElems, (button) => {
|
||||
me._toolbarElems.forEach((button) => {
|
||||
const isTopicAction = button.isTopicAction();
|
||||
const isRelAction = button.isRelAction();
|
||||
|
||||
if (isTopicAction || isRelAction) {
|
||||
if ((isTopicAction && topics.length != 0) || (isRelAction && rels.length != 0)) {
|
||||
if ((isTopicAction && topics.length !== 0) || (isRelAction && rels.length !== 0)) {
|
||||
button.enable();
|
||||
} else {
|
||||
button.disable();
|
||||
@ -440,7 +439,7 @@ class Menu extends IMenu {
|
||||
const topics = designer.getModel().filterSelectedTopics();
|
||||
const rels = designer.getModel().filterSelectedRelationships();
|
||||
|
||||
_.each(me._toolbarElems, (button) => {
|
||||
me._toolbarElems.forEach((button) => {
|
||||
const isTopicAction = button.isTopicAction();
|
||||
const isRelAction = button.isRelAction();
|
||||
|
||||
|
@ -17,13 +17,12 @@
|
||||
*/
|
||||
import TestSuite from './TestSuite';
|
||||
import LayoutManager from '../../../src/components/layout/LayoutManager';
|
||||
import OriginalLayout from '../../../src/components/layout/OriginalLayout';
|
||||
|
||||
const FreeTestSuite = new Class({
|
||||
Extends: TestSuite,
|
||||
|
||||
initialize() {
|
||||
class FreeTestSuite extends TestSuite {
|
||||
constructor() {
|
||||
$('#freeTest').css('display', 'block');
|
||||
|
||||
super();
|
||||
this.testFreePosition();
|
||||
this.testFreePredict();
|
||||
this.testReconnectFreeNode();
|
||||
@ -32,7 +31,7 @@ const FreeTestSuite = new Class({
|
||||
this.testBalancedFreePredict();
|
||||
this.testFreeReorder();
|
||||
this.testFreeOverlap();
|
||||
},
|
||||
}
|
||||
|
||||
testFreePosition() {
|
||||
console.log('testFreePosition:');
|
||||
@ -142,7 +141,7 @@ const FreeTestSuite = new Class({
|
||||
this._assertFreePosition(manager, null, null);
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testFreePredict() {
|
||||
console.log('testFreePredict:');
|
||||
@ -212,7 +211,7 @@ const FreeTestSuite = new Class({
|
||||
);
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testReconnectFreeNode() {
|
||||
console.log('testReconnectFreeNode:');
|
||||
@ -302,7 +301,7 @@ const FreeTestSuite = new Class({
|
||||
this._assertFreePosition(manager, 8, { x: 370, y: 30 });
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testSiblingOverlapping() {
|
||||
console.log('testSiblingOverlapping:');
|
||||
@ -335,7 +334,7 @@ const FreeTestSuite = new Class({
|
||||
this._assertFreePosition(manager, 7, { x: 250, y: 100 });
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testRootNodeChildrenPositioning() {
|
||||
console.log('testRootNodeChildrenPositioning:');
|
||||
@ -378,7 +377,7 @@ const FreeTestSuite = new Class({
|
||||
// this._assertFreePosition(manager, 6, {x:-150, y:-50});
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testBalancedFreePredict() {
|
||||
console.log('testBalancedFreePredict:');
|
||||
@ -398,7 +397,7 @@ const FreeTestSuite = new Class({
|
||||
);
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testFreeReorder() {
|
||||
console.log('testFreeReorder:');
|
||||
@ -435,7 +434,7 @@ const FreeTestSuite = new Class({
|
||||
);
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
testFreeOverlap() {
|
||||
console.log('testFreeOverlap:');
|
||||
@ -474,7 +473,7 @@ const FreeTestSuite = new Class({
|
||||
);
|
||||
|
||||
console.log('OK!\n\n');
|
||||
},
|
||||
}
|
||||
|
||||
_assertFreePosition(manager, id, position) {
|
||||
if (id != null && position.x != null && position.y != null) {
|
||||
@ -492,49 +491,35 @@ const FreeTestSuite = new Class({
|
||||
}
|
||||
|
||||
const treeSet = manager._treeSet;
|
||||
_.each(
|
||||
treeSet._rootNodes,
|
||||
function (rootNode) {
|
||||
const heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
||||
this._assertBranchCollision(treeSet, rootNode, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
},
|
||||
treeSet._rootNodes.forEach(((rootNode) => {
|
||||
const heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
||||
this._assertBranchCollision(treeSet, rootNode, heightById);
|
||||
}));
|
||||
}
|
||||
|
||||
_assertBranchCollision(treeSet, node, heightById) {
|
||||
const children = treeSet.getChildren(node);
|
||||
const childOfRootNode = treeSet._rootNodes.contains(node);
|
||||
|
||||
_.each(
|
||||
children,
|
||||
function (child) {
|
||||
const height = heightById[child.getId()];
|
||||
let siblings = treeSet.getSiblings(child);
|
||||
if (childOfRootNode) {
|
||||
siblings = siblings.filter((sibling) => child.getOrder() % 2 == sibling.getOrder() % 2);
|
||||
}
|
||||
_.each(
|
||||
siblings,
|
||||
function (sibling) {
|
||||
this._branchesOverlap(child, sibling, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
},
|
||||
this,
|
||||
);
|
||||
children.forEach((child) => {
|
||||
const height = heightById[child.getId()];
|
||||
let siblings = treeSet.getSiblings(child);
|
||||
if (childOfRootNode) {
|
||||
siblings = siblings.filter((sibling) => child.getOrder() % 2 == sibling.getOrder() % 2);
|
||||
}
|
||||
|
||||
_.each(
|
||||
children,
|
||||
function (child) {
|
||||
this._assertBranchCollision(treeSet, child, heightById);
|
||||
},
|
||||
this,
|
||||
);
|
||||
},
|
||||
siblings.forEach((sibling) => {
|
||||
this._branchesOverlap(child, sibling, heightById);
|
||||
});
|
||||
|
||||
_branchesOverlap(branchA, branchB, heightById) {
|
||||
});
|
||||
|
||||
children.forEach(((child) => {
|
||||
OriginalLayout._assertBranchCollision(treeSet, child, heightById);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
static _branchesOverlap(branchA, branchB, heightById) {
|
||||
const topA = branchA.getPosition().y - heightById[branchA.getId()] / 2;
|
||||
const bottomA = branchA.getPosition().y + heightById[branchA.getId()] / 2;
|
||||
const topB = branchB.getPosition().y - heightById[branchB.getId()] / 2;
|
||||
@ -544,7 +529,7 @@ const FreeTestSuite = new Class({
|
||||
topA >= bottomB || bottomA <= topB,
|
||||
`Branches ${branchA.getId()} and ${branchB.getId()} overlap`,
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default FreeTestSuite;
|
||||
|
@ -14,7 +14,6 @@
|
||||
<script type='text/javascript' src='js/jquery.js'></script>
|
||||
<script type='text/javascript' src='js/jquery-mousewheel.js'></script>
|
||||
<script type='text/javascript' src='js/hotkeys.js'></script>
|
||||
<script type='text/javascript' src='js/underscorejs.js'></script>
|
||||
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.js"></script>
|
||||
<script src="js/less.js" type="text/javascript"></script>
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
<script type='text/javascript' src='js/jquery.js'></script>
|
||||
<script type='text/javascript' src='js/bootstrap.js'></script>
|
||||
<script type='text/javascript' src='js/underscore.js'></script>
|
||||
<script type='text/javascript' src='js/mootools-core.js'></script>
|
||||
<script type='text/javascript' src='js/core.js'></script>
|
||||
<script type='text/javascript' src='js/less.js'></script>
|
||||
|
@ -1,5 +1,5 @@
|
||||
describe('Free Test Suite', () => {
|
||||
beforeEach(function () {
|
||||
beforeEach(function beforeEach() {
|
||||
this.addMatchers({
|
||||
toNotBeBranchesOverlap(expected) {
|
||||
const a = this.actual;
|
||||
@ -13,19 +13,21 @@ describe('Free Test Suite', () => {
|
||||
const children = treeSet.getChildren(node);
|
||||
const childOfRootNode = treeSet._rootNodes.contains(node);
|
||||
|
||||
_.each(children, function (child) {
|
||||
children.foeEach(((child) => {
|
||||
let siblings = treeSet.getSiblings(child);
|
||||
if (childOfRootNode) {
|
||||
siblings = siblings.filter((sibling) => (child.getOrder() % 2) == (sibling.getOrder() % 2));
|
||||
}
|
||||
_.each(siblings, (sibling) => {
|
||||
branchesOverlap(child, sibling, heightById);
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
_.each(children, (child) => {
|
||||
siblings.foeEach(((sibling) => {
|
||||
branchesOverlap(child, sibling, heightById);
|
||||
}).bind(this));
|
||||
|
||||
}).bind(this));
|
||||
|
||||
children.foeEach((child) => {
|
||||
branchCollision(treeSet, child, heightById);
|
||||
}, this);
|
||||
}).bind((this));
|
||||
}
|
||||
|
||||
function branchesOverlap(branchA, branchB, heightById) {
|
||||
@ -36,7 +38,7 @@ describe('Free Test Suite', () => {
|
||||
expect([bottomA, topA]).toNotBeBranchesOverlap([bottomB, topB]);
|
||||
}
|
||||
|
||||
it('avoidCollisionTree1Test', function () {
|
||||
it('avoidCollisionTree1Test', function avoidCollisionTree1Test() {
|
||||
const position = { x: 0, y: 0 };
|
||||
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
@ -82,14 +84,14 @@ describe('Free Test Suite', () => {
|
||||
manager.layout(true);
|
||||
|
||||
const treeSet = manager._treeSet;
|
||||
_.each(treeSet._rootNodes, (rootNode) => {
|
||||
treeSet._rootNodes.beforeEach(((rootNode) => {
|
||||
const heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
||||
branchCollision(treeSet, rootNode, heightById);
|
||||
}, this);
|
||||
}).bind(this));
|
||||
});
|
||||
|
||||
// FIXME: This is broken in master. This configuration has two topics overlapping.
|
||||
it('avoidCollisionTree2Test - FAILING, commented test', function () {
|
||||
it('avoidCollisionTree2Test - FAILING, commented test', function avoidCollisionTree2Test() {
|
||||
const position = { x: 0, y: 0 };
|
||||
const manager = new mindplot.layout.LayoutManager(0, TestSuite.ROOT_NODE_SIZE);
|
||||
|
||||
@ -130,10 +132,10 @@ describe('Free Test Suite', () => {
|
||||
manager.layout(true);
|
||||
|
||||
const treeSet = manager._treeSet;
|
||||
_.each(treeSet._rootNodes, (rootNode) => {
|
||||
treeSet._rootNodes.foeEach(((rootNode) => {
|
||||
const heightById = rootNode.getSorter().computeChildrenIdByHeights(treeSet, rootNode);
|
||||
// FIXME: uncoment this line when bug is fixed, branchCollision(treeSet, rootNode, heightById);
|
||||
}, this);
|
||||
}).bind(this));
|
||||
});
|
||||
|
||||
it('predictTest', () => {
|
||||
|
@ -18,7 +18,6 @@ module.exports = {
|
||||
test: /.(js)$/,
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
path.resolve(__dirname, '../../libraries/underscore-min'),
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -35,7 +35,6 @@ module.exports = {
|
||||
test: /.js$/,
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
path.resolve(__dirname, '../../libraries/underscore-min'),
|
||||
],
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user