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

tilde

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49777 954022d7-b5bf-4e40-9824-e11837661b57
parent 98a0030b
...@@ -765,17 +765,18 @@ CSign.prototype.draw_breve = function(up) ...@@ -765,17 +765,18 @@ CSign.prototype.draw_breve = function(up)
function CTilde() function CTilde()
{ {
this.incline = 0;
CBaseDiacritic.call(this); CBaseDiacritic.call(this);
} }
extend(CTilde, CBaseDiacritic); extend(CTilde, CBaseDiacritic);
CTilde.prototype.recalculateSize = function() CTilde.prototype.fixSize = function()
{ {
var betta = this.getTxtPrp().FontSize/36; var betta = this.getTxtPrp().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999 var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta; var height = 2.469444444444444*betta;
this.size = {width: width, heigth: height}; this.size = {width: width, height: height};
} }
CTilde.prototype.draw = function() CTilde.prototype.draw = function()
{ {
...@@ -1001,10 +1002,15 @@ function CAccent() ...@@ -1001,10 +1002,15 @@ function CAccent()
this.accent = null; this.accent = null;
CMathBase.call(this); CMathBase.call(this);
} }
extend(old_CAccent, CMathBase); extend(CAccent, CMathBase);
CAccent.prototype.init = function(props) CAccent.prototype.init = function(props)
{ {
var code = props.chr.value.charCodeAt(0); var code;
if(typeof(props.chr.value) === "string")
code = props.chr.value.charCodeAt(0);
// var code = props.chr.value.charCodeAt(0);
var bDot = code === 0x307 || props.chr.type === ACCENT_ONE_DOT, var bDot = code === 0x307 || props.chr.type === ACCENT_ONE_DOT,
b2Dots = code === 0x308 || props.chr.type === ACCENT_TWO_DOTS, b2Dots = code === 0x308 || props.chr.type === ACCENT_TWO_DOTS,
...@@ -1038,6 +1044,10 @@ CAccent.prototype.init = function(props) ...@@ -1038,6 +1044,10 @@ CAccent.prototype.init = function(props)
this.accent = new CLine(); this.accent = new CLine();
this.accent.setPrp(DOUBLE_LINE); this.accent.setPrp(DOUBLE_LINE);
} }
else if(code === 0x303 || props.chr.type === ACCENT_TILDE)
{
this.accent = new CTilde();
}
else else
{ {
this.accent = new CMathText(); this.accent = new CMathText();
...@@ -1046,6 +1056,8 @@ CAccent.prototype.init = function(props) ...@@ -1046,6 +1056,8 @@ CAccent.prototype.init = function(props)
this.bDiacritic = false; this.bDiacritic = false;
} }
var tPrp = this.getTxtPrp();
this.accent.setTxtPrp(tPrp);
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
...@@ -1057,7 +1069,7 @@ CAccent.prototype.recalculateSize = function() ...@@ -1057,7 +1069,7 @@ CAccent.prototype.recalculateSize = function()
this.dH = 0.7*this.getTxtPrp().FontSize/36; this.dH = 0.7*this.getTxtPrp().FontSize/36;
if(this.bDiacritic) if(this.bDiacritic)
this.accent.fixSize(content.size.width, content.Incline()); this.accent.fixSize(content.size.width, content.IsIncline());
var height = this.accent.size.height + content.size.height, var height = this.accent.size.height + content.size.height,
center = this.accent.size.height + content.size.center; center = this.accent.size.height + content.size.center;
...@@ -1077,10 +1089,26 @@ CAccent.prototype.recalculateSize = function() ...@@ -1077,10 +1089,26 @@ CAccent.prototype.recalculateSize = function()
CAccent.prototype.setPosition = function(pos) CAccent.prototype.setPosition = function(pos)
{ {
this.pos = {x: pos.x, y: pos.y - this.size.center}; this.pos = {x: pos.x, y: pos.y - this.size.center};
var pos =
{
x: this.pos.x + (this.size.width - this.elements[0][0].size.width)/2;
};
this.elements[0][0].setPosition() var pos =
{
x: this.pos.x + (this.size.width - this.accent.size.width)/2,
y: this.pos.y
};
this.accent.setPosition(pos);
var content = this.elements[0][0];
pos =
{
x: this.pos.x + (this.size.width - content.size.width)/2,
y: this.pos.y + this.accent.size.height
};
this.elements[0][0].setPosition(pos);
}
CAccent.prototype.draw = function()
{
this.accent.draw();
this.elements[0][0].draw();
} }
...@@ -38,11 +38,12 @@ function mathElem(_val) ...@@ -38,11 +38,12 @@ function mathElem(_val)
} }
//TODO
// доделать GroupCharacter / Delimiter в качестве cheracter может быть любой символ
//TODO //TODO
//переделать/продумать DotIndef, т.к. при перетаскивании из одного места в другое флаг DotIndef может измениться для другого контента //переделать/продумать DotIndef, т.к. при перетаскивании из одного места в другое флаг DotIndef может измениться для другого контента
//TODO //TODO
//пересмотреть this.dW и this.dH //пересмотреть this.dW и this.dH
...@@ -61,8 +62,7 @@ function mathElem(_val) ...@@ -61,8 +62,7 @@ function mathElem(_val)
// TODO Refactoring // TODO Refactoring
// 1. // 1. (!!) повтор IsIncline, IsHighElement
// 2. (!!) повтор IsIncline, IsHighElement
function CMathContent() function CMathContent()
...@@ -3961,15 +3961,7 @@ CMathContent.prototype = ...@@ -3961,15 +3961,7 @@ CMathContent.prototype =
/*var diac = this.addMComponent(15); /*var diac = this.addMComponent(15);
diac.init(3); diac.init(3);
diac.fillPlaceholders();*/ diac.fillPlaceholders();*/
var delim = this.addMComponent(MATH_GROUP_CHARACTER);
var props =
{
chr: {value: "."},
location: LOCATION_TOP,
justif: VJUST_BOT
};
delim.init(props);
delim.fillPlaceholders();
break; break;
case 153: case 153:
var diac = this.addMComponent(15); var diac = this.addMComponent(15);
...@@ -4010,10 +4002,13 @@ CMathContent.prototype = ...@@ -4010,10 +4002,13 @@ CMathContent.prototype =
diac.fillPlaceholders(); diac.fillPlaceholders();
break; break;
case 160: case 160:
var diac = this.addMComponent(13); var accent = this.addMComponent(MATH_ACCENT);
diac.init(); var props =
diac.setIndex(2); {
diac.fillPlaceholders(); chr: {type: ACCENT_TILDE}
};
accent.init(props);
accent.fillPlaceholders();
break; break;
case 161: case 161:
var line = this.addMComponent(14); var line = this.addMComponent(14);
......
...@@ -96,7 +96,8 @@ var ACCENT_LINE = 7; ...@@ -96,7 +96,8 @@ var ACCENT_LINE = 7;
var ACCENT_DOUBLE_LINE = 8; var ACCENT_DOUBLE_LINE = 8;
var SINGLE_LINE = 9; var SINGLE_LINE = 9;
var DOUBLE_LINE = 10; var DOUBLE_LINE = 10;
var MATH_TEXT = 11; var ACCENT_TILDE = 11;
var MATH_TEXT = 12;
var MATRIX_CENTER = 0; var MATRIX_CENTER = 0;
var MATRIX_TOP = 1; var MATRIX_TOP = 1;
......
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