[DE] Refactoring math loading

This commit is contained in:
Julia Radzhabova 2019-08-15 16:39:48 +03:00
parent faecea9e11
commit cbd293523a

View file

@ -2454,35 +2454,29 @@ define([
translationTable[Common.define.c_oAscMathType[name]] = this[translate];
}
}
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null;
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data;
if (equation) {
count = equation.get_Data().length;
data = equation.get_Data();
count = data.length;
if (count) {
for (var j = 0; j < count; ++j) {
id = equation.get_Data()[j].get_Id();
width = equation.get_Data()[j].get_W();
height = equation.get_Data()[j].get_H();
var group = data[j];
id = group.get_Id();
width = group.get_W();
height = group.get_H();
store = new Backbone.Collection([], {
model: DE.Models.EquationModel
});
if (store) {
var allItemsCount = 0, itemsCount = 0, ids = 0;
length = equation.get_Data()[j].get_Data().length;
var allItemsCount = 0, itemsCount = 0, ids = 0, arr = [];
length = group.get_Data().length;
for (i = 0; i < length; ++i) {
eqStore = equation.get_Data()[j].get_Data()[i];
eqStore = group.get_Data()[i];
itemsCount = eqStore.get_Data().length;
for (var p = 0; p < itemsCount; ++p) {
eq = eqStore.get_Data()[p];
ids = eq.get_Id();
@ -2491,8 +2485,7 @@ define([
if (translationTable.hasOwnProperty(ids)) {
translate = translationTable[ids];
}
store.add({
arr.push({
data : {equationType: ids},
tip : translate,
allowSelected : true,
@ -2506,7 +2499,7 @@ define([
allItemsCount += itemsCount;
}
store.add(arr);
width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt(370 / (height + 10)) * (height + 10);
@ -2518,9 +2511,7 @@ define([
});
}
}
equationsStore.add(equationgrouparray);
this.fillEquations();
}
}