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