Commit e2a1b568 authored by Oleg Korshul's avatar Oleg Korshul

правка редактирования с линейками

parent 356943b5
...@@ -325,6 +325,7 @@ asc_docs_api.prototype['asc_SetDocumentPlaceChangedEnabled'] = asc_docs_api.prot ...@@ -325,6 +325,7 @@ asc_docs_api.prototype['asc_SetDocumentPlaceChangedEnabled'] = asc_docs_api.prot
asc_docs_api.prototype['asc_SetViewRulers'] = asc_docs_api.prototype.asc_SetViewRulers; asc_docs_api.prototype['asc_SetViewRulers'] = asc_docs_api.prototype.asc_SetViewRulers;
asc_docs_api.prototype['asc_SetViewRulersChange'] = asc_docs_api.prototype.asc_SetViewRulersChange; asc_docs_api.prototype['asc_SetViewRulersChange'] = asc_docs_api.prototype.asc_SetViewRulersChange;
asc_docs_api.prototype['asc_GetViewRulers'] = asc_docs_api.prototype.asc_GetViewRulers; asc_docs_api.prototype['asc_GetViewRulers'] = asc_docs_api.prototype.asc_GetViewRulers;
asc_docs_api.prototype['asc_SetDocumentUnits'] = asc_docs_api.prototype.asc_SetDocumentUnits;
asc_docs_api.prototype['SetMobileVersion'] = asc_docs_api.prototype.SetMobileVersion; asc_docs_api.prototype['SetMobileVersion'] = asc_docs_api.prototype.SetMobileVersion;
asc_docs_api.prototype['GoToHeader'] = asc_docs_api.prototype.GoToHeader; asc_docs_api.prototype['GoToHeader'] = asc_docs_api.prototype.GoToHeader;
asc_docs_api.prototype['changeSlideSize'] = asc_docs_api.prototype.changeSlideSize; asc_docs_api.prototype['changeSlideSize'] = asc_docs_api.prototype.changeSlideSize;
......
...@@ -97,11 +97,20 @@ function CVerRulerRepaintChecker() ...@@ -97,11 +97,20 @@ function CVerRulerRepaintChecker()
this.BlitTop = 0; this.BlitTop = 0;
} }
function RulerCorrectPosition(val, mm_1_8, mm_1_4, margin) function RulerCorrectPosition(_ruler, val, margin)
{ {
if (global_keyboardEvent.AltKey) if (global_keyboardEvent.AltKey)
return val; return val;
var mm_1_4 = 10 / 4;
if (_ruler.Units == c_oAscDocumentUnits.Inch)
mm_1_4 = 25.4 / 16;
else if (_ruler.Units == c_oAscDocumentUnits.Point)
mm_1_4 = 25.4 / 12;
var mm_1_8 = mm_1_4 / 2;
if (undefined === margin) if (undefined === margin)
return (((val + mm_1_8) / mm_1_4) >> 0) * mm_1_4; return (((val + mm_1_8) / mm_1_4) >> 0) * mm_1_4;
...@@ -1107,7 +1116,7 @@ function CHorRuler() ...@@ -1107,7 +1116,7 @@ function CHorRuler()
} }
case 1: case 1:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
if (newVal < 0) if (newVal < 0)
newVal = 0; newVal = 0;
...@@ -1133,7 +1142,7 @@ function CHorRuler() ...@@ -1133,7 +1142,7 @@ function CHorRuler()
} }
case 2: case 2:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
var min = this.m_dMarginLeft; var min = this.m_dMarginLeft;
if ((this.m_dMarginLeft + this.m_dIndentLeft) > min) if ((this.m_dMarginLeft + this.m_dIndentLeft) > min)
...@@ -1161,7 +1170,7 @@ function CHorRuler() ...@@ -1161,7 +1170,7 @@ function CHorRuler()
} }
case 3: case 3:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
var min = 0; var min = 0;
if (this.m_dIndentLeftFirst < this.m_dIndentLeft) if (this.m_dIndentLeftFirst < this.m_dIndentLeft)
...@@ -1202,7 +1211,7 @@ function CHorRuler() ...@@ -1202,7 +1211,7 @@ function CHorRuler()
} }
case 4: case 4:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
if (newVal < 0) if (newVal < 0)
newVal = 0; newVal = 0;
...@@ -1230,7 +1239,7 @@ function CHorRuler() ...@@ -1230,7 +1239,7 @@ function CHorRuler()
} }
case 5: case 5:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
if (newVal < 0) if (newVal < 0)
newVal = 0; newVal = 0;
...@@ -1258,7 +1267,7 @@ function CHorRuler() ...@@ -1258,7 +1267,7 @@ function CHorRuler()
} }
case 6: case 6:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
if (newVal > (this.m_oPage.width_mm)) if (newVal > (this.m_oPage.width_mm))
newVal = this.m_oPage.width_mm; newVal = this.m_oPage.width_mm;
...@@ -1290,7 +1299,7 @@ function CHorRuler() ...@@ -1290,7 +1299,7 @@ function CHorRuler()
} }
case 7: case 7:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var newVal = RulerCorrectPosition(this, _x, _margin_left);
this.m_dCurrentTabNewPosition = newVal - _margin_left; this.m_dCurrentTabNewPosition = newVal - _margin_left;
...@@ -1314,7 +1323,7 @@ function CHorRuler() ...@@ -1314,7 +1323,7 @@ function CHorRuler()
} }
case 8: case 8:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, this.TableMarginLeftTrackStart); var newVal = RulerCorrectPosition(this, _x, this.TableMarginLeftTrackStart);
// сначала определим граничные условия // сначала определим граничные условия
var _min = 0; var _min = 0;
...@@ -1359,7 +1368,7 @@ function CHorRuler() ...@@ -1359,7 +1368,7 @@ function CHorRuler()
} }
case 9: case 9:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, this.TableMarginLeftTrackStart); var newVal = RulerCorrectPosition(this, _x, this.TableMarginLeftTrackStart);
// сначала определим граничные условия // сначала определим граничные условия
var markup = this.m_oColumnMarkup; var markup = this.m_oColumnMarkup;
...@@ -1508,7 +1517,7 @@ function CHorRuler() ...@@ -1508,7 +1517,7 @@ function CHorRuler()
} }
case 10: case 10:
{ {
var newVal = RulerCorrectPosition(_x, mm_1_8, mm_1_4, this.TableMarginLeftTrackStart); var newVal = RulerCorrectPosition(this, _x, this.TableMarginLeftTrackStart);
// сначала определим граничные условия // сначала определим граничные условия
var markup = this.m_oColumnMarkup; var markup = this.m_oColumnMarkup;
...@@ -1964,7 +1973,7 @@ function CHorRuler() ...@@ -1964,7 +1973,7 @@ function CHorRuler()
var mm_1_4 = 10 / 4; var mm_1_4 = 10 / 4;
var mm_1_8 = mm_1_4 / 2; var mm_1_8 = mm_1_4 / 2;
var _new_tab_pos = RulerCorrectPosition(_x, mm_1_8, mm_1_4, _margin_left); var _new_tab_pos = RulerCorrectPosition(this, _x, _margin_left);
_new_tab_pos -= _margin_left; _new_tab_pos -= _margin_left;
this.m_arrTabs[this.m_arrTabs.length] = new CTab(_new_tab_pos, word_control.m_nTabsType); this.m_arrTabs[this.m_arrTabs.length] = new CTab(_new_tab_pos, word_control.m_nTabsType);
...@@ -3246,7 +3255,7 @@ function CVerRuler() ...@@ -3246,7 +3255,7 @@ function CVerRuler()
} }
case 1: case 1:
{ {
var newVal = RulerCorrectPosition(_y, mm_1_8, mm_1_4, this.m_dMarginTop); var newVal = RulerCorrectPosition(this, _y, this.m_dMarginTop);
if (newVal > (this.m_dMarginBottom - 30)) if (newVal > (this.m_dMarginBottom - 30))
newVal = this.m_dMarginBottom - 30; newVal = this.m_dMarginBottom - 30;
...@@ -3265,7 +3274,7 @@ function CVerRuler() ...@@ -3265,7 +3274,7 @@ function CVerRuler()
} }
case 2: case 2:
{ {
var newVal = RulerCorrectPosition(_y, mm_1_8, mm_1_4, this.m_dMarginTop); var newVal = RulerCorrectPosition(this, _y, this.m_dMarginTop);
if (newVal < (this.m_dMarginTop + 30)) if (newVal < (this.m_dMarginTop + 30))
newVal = this.m_dMarginTop + 30; newVal = this.m_dMarginTop + 30;
...@@ -3284,7 +3293,7 @@ function CVerRuler() ...@@ -3284,7 +3293,7 @@ function CVerRuler()
} }
case 3: case 3:
{ {
var newVal = RulerCorrectPosition(_y, mm_1_8, mm_1_4, this.m_dMarginTop); var newVal = RulerCorrectPosition(this, _y, this.m_dMarginTop);
if (newVal > this.header_bottom) if (newVal > this.header_bottom)
newVal = this.header_bottom; newVal = this.header_bottom;
...@@ -3303,7 +3312,7 @@ function CVerRuler() ...@@ -3303,7 +3312,7 @@ function CVerRuler()
} }
case 4: case 4:
{ {
var newVal = RulerCorrectPosition(_y, mm_1_8, mm_1_4, this.m_dMarginTop); var newVal = RulerCorrectPosition(this, _y, this.m_dMarginTop);
if (newVal < 0) if (newVal < 0)
newVal = 0; newVal = 0;
...@@ -3335,7 +3344,7 @@ function CVerRuler() ...@@ -3335,7 +3344,7 @@ function CVerRuler()
_max = this.m_oTableMarkup.Rows[this.DragTablePos].Y + this.m_oTableMarkup.Rows[this.DragTablePos].H; _max = this.m_oTableMarkup.Rows[this.DragTablePos].Y + this.m_oTableMarkup.Rows[this.DragTablePos].H;
} }
var newVal = RulerCorrectPosition(_y, mm_1_8, mm_1_4, this.m_dMarginTop); var newVal = RulerCorrectPosition(this, _y, this.m_dMarginTop);
if (newVal < _min) if (newVal < _min)
newVal = _min; newVal = _min;
......
...@@ -463,6 +463,7 @@ asc_docs_api.prototype['asc_SetDocumentPlaceChangedEnabled'] = asc_docs_api.prot ...@@ -463,6 +463,7 @@ asc_docs_api.prototype['asc_SetDocumentPlaceChangedEnabled'] = asc_docs_api.prot
asc_docs_api.prototype['asc_SetViewRulers'] = asc_docs_api.prototype.asc_SetViewRulers; asc_docs_api.prototype['asc_SetViewRulers'] = asc_docs_api.prototype.asc_SetViewRulers;
asc_docs_api.prototype['asc_SetViewRulersChange'] = asc_docs_api.prototype.asc_SetViewRulersChange; asc_docs_api.prototype['asc_SetViewRulersChange'] = asc_docs_api.prototype.asc_SetViewRulersChange;
asc_docs_api.prototype['asc_GetViewRulers'] = asc_docs_api.prototype.asc_GetViewRulers; asc_docs_api.prototype['asc_GetViewRulers'] = asc_docs_api.prototype.asc_GetViewRulers;
asc_docs_api.prototype['asc_SetDocumentUnits'] = asc_docs_api.prototype.asc_SetDocumentUnits;
asc_docs_api.prototype['SetMobileVersion'] = asc_docs_api.prototype.SetMobileVersion; asc_docs_api.prototype['SetMobileVersion'] = asc_docs_api.prototype.SetMobileVersion;
asc_docs_api.prototype['GoToHeader'] = asc_docs_api.prototype.GoToHeader; asc_docs_api.prototype['GoToHeader'] = asc_docs_api.prototype.GoToHeader;
asc_docs_api.prototype['GoToFooter'] = asc_docs_api.prototype.GoToFooter; asc_docs_api.prototype['GoToFooter'] = asc_docs_api.prototype.GoToFooter;
......
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