Commit d227ca02 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. сделала раздетили для delimiters

2. спрятала bar у дроби
3. переделала готовые функции для delimiter, заменила на NoBar
4. исправила mouseMove для CSubMathbase

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47590 954022d7-b5bf-4e40-9824-e11837661b57
parent d9afd8df
function CBarFraction()
{
this.bHide = false;
CMathBase.call(this,2,1);
//!!!
//this.gapLine = 0; // толщину линии не учитываем, рисуем в области числителя
......@@ -33,9 +34,13 @@ CBarFraction.prototype.draw = function()
x2 = this.pos.x + this.size.width,
y1 = y2 = this.pos.y + this.size.center - penW/2;
MathControl.pGraph.p_color(0,0,0, 255);
MathControl.pGraph.b_color1(0,0,0, 255);
MathControl.pGraph.drawHorLine(0, y1, x1, x2, penW);
if( ! this.bHide)
{
MathControl.pGraph.p_color(0,0,0, 255);
MathControl.pGraph.b_color1(0,0,0, 255);
MathControl.pGraph.drawHorLine(0, y1, x1, x2, penW);
}
CBarFraction.superclass.draw.call(this);
}
......@@ -47,6 +52,10 @@ CBarFraction.prototype.getDenominator = function()
{
return this.elements[1][0].getElement();
}
CBarFraction.prototype.hideBar = function(flag)
{
this.bHide = flag;
}
//////////
function CNumerator()
......
......@@ -88,6 +88,15 @@ CMinimaxFunc.prototype.getIterator = function()
{
return this.elements[1][0];
}
CMinimaxFunc.prototype.old_setDistance = function()
{
var iter = this.elements[1][0].size,
ascent = iter.center + this.params.font.metrics.Placeholder.Height*DIV_CENTER;
this.dH = this.params.font.metrics.Placeholder.Height - ascent;
this.dW = 0;
//this.dH = this.params.font.FontSize/16*g_dKoef_pt_to_mm;
}
function CMinimax(num)
{
......@@ -96,7 +105,6 @@ function CMinimax(num)
this.num = 0;
else
this.num = num;
}
extend(CMinimax, CSubMathBase);
CMinimax.prototype.setContent = function()
......@@ -134,6 +142,44 @@ CMinimax.prototype.getArgument = function()
{
return this.elements[0][1];
}
CMinimax.prototype.setDistance = function()
{
this.dW = this.params.font.FontSize/6*g_dKoef_pt_to_mm;
this.dH = 0;
}
function CMathFunc()
{
CMathBase.call(this, 1,2);
}
extend(CMathFunc, CMathBase);
CMathFunc.prototype.setContent = function()
{
var oFunc = new CMathContent();
var GParms = Common_CopyObj(this.params);
GParms.bMText = false; //!!
oFunc.init(GParms);
var oArg = new CMathContent();
oArg.init(this.params);
oArg.fillPlaceholders();
CMathFunc.superclass.setContent.call(this, oFunc, oArg);
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.params.font.FontSize/6*g_dKoef_pt_to_mm;
this.dH = 0;
}
CMathFunc.prototype.getFunction = function()
{
return this.elements[0][0];
}
CMathFunc.prototype.getArgument = function()
{
return this.elements[0][1];
}
function old_CMathFunc(num)
{
......@@ -188,41 +234,6 @@ old_CDifferential.prototype.setContent = function()
old_CMathFunc.superclass.setContent.call(this, oDiff);
}
function CMathFunc()
{
CMathBase.call(this, 1,2);
}
extend(CMathFunc, CMathBase);
CMathFunc.prototype.setContent = function()
{
var oFunc = new CMathContent();
var GParms = Common_CopyObj(this.params);
GParms.bMText = false; //!!
oFunc.init(GParms);
var oArg = new CMathContent();
oArg.init(this.params);
oArg.fillPlaceholders();
CMathFunc.superclass.setContent.call(this, oFunc, oArg);
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.params.font.FontSize/6*g_dKoef_pt_to_mm;
this.dH = 0;
}
CMathFunc.prototype.getFunction = function()
{
return this.elements[0][0];
}
CMathFunc.prototype.getArgument = function()
{
return this.elements[0][1];
}
function old_CTrigFunc(num)
{
if(num != num + 0 || num < 0 || num > 14)
......
......@@ -51,6 +51,8 @@ function mathElem(_val, _gps, _w )
// TODO Refactoring
// 1. переделать mouseMove (вызов из this.SelectContent, а не из this.Root, далее если state == false, подниматься наверх)
// 1. (!!) повтор IsIncline, IsHighElement
// 2. (!!) переделать add / add_mathComponent / addText / addLetter
// 3. home/end if( IsTarget() )
......@@ -140,6 +142,7 @@ CMathContent.prototype =
}
this.recalculate();
},
fillPlaceholders: function()
{
var gps = new dist(0,0,0,0);
......@@ -1820,10 +1823,6 @@ CMathComposition.prototype =
this.ClearSelect();
this.CurrentContent = this.SelectContent = this.Root.mouseDown({x: mouseX, y: mouseY}, -1);
/*if(typeof(this.CurrentContent) == "undefined")
{
var stop = true;
}*/
this.CheckTarget();
},
......@@ -1832,9 +1831,16 @@ CMathComposition.prototype =
if(this.Root.selection.active)
{
this.ClearSelect();
/*mouseX = 18.479166666666664;
mouseY = 9.76875;*/
var movement = this.Root.mouseMove({x: mouseX, y: mouseY});
this.SelectContent = movement.SelectContent;
this.CheckTarget();
}
......@@ -2264,29 +2270,45 @@ CMathComposition.prototype =
delimBase.addMathComponent_2(209);
delimiter.ResizeReverse_2();
break;
case 119:
fract = this.SelectContent.addMathComponent_2(0);
fract.hideBar(true);
fract.ResizeReverse_2();
break;
case 120:
delimiter = this.SelectContent.addMathComponent_2(83);
delimBase = delimiter.getBase();
fract = delimBase.addMathComponent_2(0);
fract.hideBar(true);
delimiter.ResizeReverse_2();
break;
case 121:
break;
case 122:
delimiter = this.SelectContent.addMathComponent_2(83);
delimBase = delimiter.getBase();
matrix = delimBase.addMathComponent_2(207);
fract = delimBase.addMathComponent_2(0);
fract.hideBar(true);
matrElem = matrix.getElement(0, 0);
matrElem.addText("n");
num = fract.getNumerator();
num.addText("n");
matrElem2 = matrix.getElement(1, 0);
matrElem2.addText("k");
den = fract.getDenominator();
den.addText("k");
delimiter.ResizeReverse_2();
break;
case 123:
delimiter = this.SelectContent.addMathComponent_2(86);
delimBase = delimiter.getBase();
matrix = delimBase.addMathComponent_2(207);
fract = delimBase.addMathComponent_2(0);
fract.hideBar(true);
matrElem = matrix.getElement(0, 0);
matrElem.addText("n");
num = fract.getNumerator();
num.addText("n");
matrElem2 = matrix.getElement(1, 0);
matrElem2.addText("k");
den = fract.getDenominator();
den.addText("k");
delimiter.ResizeReverse_2();
break;
......@@ -3075,12 +3097,16 @@ function AddEquation(ind)
//mathElem = new CWhiteSquareBracket(5);
break;
case 95:
mathElem = new CSeparatorDelimiter(0, 2);
break;
case 96:
mathElem = new CSeparatorDelimiter(1, 2);
break;
case 97:
mathElem = new CSeparatorDelimiter(3, 2);
break;
case 98:
mathElem = new CSeparatorDelimiter(3, 3);
break;
case 99:
mathElem = new CDelimiter(0, 2, 0); // parentheses
......
......@@ -27,7 +27,8 @@ function CMathText(params)
this.SUBCONTENT = false;
this.empty = false;
this.transform = {
this.transform =
{
sx: 1,
shy: 0,
shx: 0,
......
......@@ -426,7 +426,7 @@ function CDelimiter(type, loc, turn1, turn2)
CMathBase.call(this, countRow, countCol);
}
extend(CDelimiter, CMathBase);
CDelimiter.prototype.setContent = function()
CDelimiter.prototype.setContent = function(arg)
{
var operator1, operator2,
loc1, loc2;
......@@ -500,10 +500,16 @@ CDelimiter.prototype.setContent = function()
operator2.init(params2);
operator2.setLocation(loc2, this.turn2);
var argument = new CMathContent();
argument.init(this.params);
argument.relate(this);
argument.fillPlaceholders();
var argument;
if(arg !== null && typeof(arg)!== "undefined")
argument = arg;
else
{
argument = new CMathContent();
argument.init(this.params);
argument.relate(this);
argument.fillPlaceholders();
}
this.base = argument;
......@@ -2808,4 +2814,91 @@ CCombiningDoubleArrow.prototype.calcCoord = function(measure)
return {XX: XX, YY: YY, W: W, H: H};
}
\ No newline at end of file
}
function CSeparatorDelimiter(type, column)
{
this.column = column;
CDelimiter.call(this, type, 4, 0, 1);
}
extend(CSeparatorDelimiter, CDelimiter);
CSeparatorDelimiter.prototype.setContent = function()
{
var arg = new CSeparator(this.column);
arg.init(this.params);
arg.relate(this);
arg.fillPlaceholders();
CSeparatorDelimiter.superclass.setContent.call(this, arg);
}
CSeparatorDelimiter.prototype.mouseMove = function(mCoord)
{
var elem = this.findDisposition( mCoord);
var state = true,
SelectContent = null;
if(elem.pos.x == this.CurPos_X && elem.pos.y == this.CurPos_Y && elem.inside_flag === -1 )
{
movement = this.elements[this.CurPos_X][this.CurPos_Y].mouseMove(elem.mCoord);
SelectContent = movement.SelectContent;
state = movement.state;
}
else
{
state = false;
}
return {state: state, SelectContent: SelectContent};
}
function CSeparator(column)
{
CMathBase.call(this, 1, column);
}
extend(CSeparator, CMathBase);
CSeparator.prototype.setDistance = function()
{
this.dH = 0;
this.dW = this.params.font.FontSize/3*g_dKoef_pt_to_mm;
}
CSeparator.prototype.draw = function()
{
var x = this.pos.x,
y = this.pos.y;
var w = this.elements[0][0].size.width + this.dW/2;
var intGrid = MathControl.pGraph.GetIntegerGrid();
MathControl.pGraph.SetIntegerGrid(false);
MathControl.pGraph.p_width(1000);
MathControl.pGraph.b_color1(0,0,0, 255);
pW = this.params.font.FontSize/18*g_dKoef_pt_to_mm;
for(var i = 0; i < this.nCol - 1; i++)
{
var x1 = x + w - pW/2, y1 = y,
x2 = x + pW/2 + w, y2 = y,
x3 = x2, y3 = y + this.size.height,
x4 = x1, y4 = y3;
MathControl.pGraph._s();
MathControl.pGraph._m(x1, y1);
MathControl.pGraph._l(x2, y2);
MathControl.pGraph._l(x3, y3);
MathControl.pGraph._l(x4, y4);
MathControl.pGraph._l(x1, y1);
MathControl.pGraph.df();
w += this.elements[0][i+1].size.width + this.dW;
}
MathControl.pGraph.SetIntegerGrid(intGrid);
CSeparator.superclass.draw.call(this);
}
......@@ -30,7 +30,7 @@ extend(CSubMathBase, CMathBase);
h += maxWH.heights[i];
}
}*/
CSubMathBase.prototype.mouseMove = function( mCoord )
CSubMathBase.prototype.old_mouseMove = function( mCoord )
{
var res = true;
var elem = this.findDisposition( mCoord);
......@@ -43,35 +43,22 @@ CSubMathBase.prototype.mouseMove = function( mCoord )
return res;
}
function Fraction()
{
this.type = 0;
}
Fraction.prototype =
CSubMathBase.prototype.mouseMove = function( mCoord )
{
GetProperty: function()
{
var elem = this.findDisposition( mCoord);
var state = true,
SelectContent = null;
if(elem.pos.x == this.CurPos_X && elem.pos.y == this.CurPos_Y && elem.inside_flag === -1 )
{
movement = this.elements[this.CurPos_X][this.CurPos_Y].mouseMove(elem.mCoord);
SelectContent = movement.SelectContent;
state = movement.state;
}
else
{
state = false;
}
}
function Degree()
{
this.type = 1;
}
function Nary()
{
this.type = 2;
}
function Trigonometric()
{
this.type = 3;
}
function Minimax()
{
this.type = 3;
}
return {state: state, SelectContent: SelectContent};
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment