Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
6458dadc
Commit
6458dadc
authored
7 years ago
by
Alexey.Musinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for build
parent
d6f942d2
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
149 additions
and
201 deletions
+149
-201
common/Native/Wrappers/DrawingDocument.js
common/Native/Wrappers/DrawingDocument.js
+149
-201
No files found.
common/Native/Wrappers/DrawingDocument.js
View file @
6458dadc
...
...
@@ -47,6 +47,19 @@ var g_dKoef_mm_to_pix = AscCommon.g_dKoef_mm_to_pix;
var
_canvas_tables
=
null
;
var
_table_styles
=
null
;
var
c_oContentControlTrack
=
{
Hover
:
0
,
In
:
1
};
function
CContentControlTrack
(
_id
,
_type
,
_rects
,
_transform
)
{
this
.
id
=
(
undefined
==
_id
)
?
-
1
:
_id
;
this
.
type
=
(
undefined
==
_type
)
?
-
1
:
_type
;
this
.
rects
=
(
undefined
==
_rects
)
?
null
:
_rects
;
this
.
transform
=
(
undefined
==
_transform
)
?
null
:
_transform
;
}
function
CColumnsMarkupColumn
()
{
this
.
W
=
0
;
...
...
@@ -66,7 +79,7 @@ function CColumnsMarkup()
this
.
SectPr
=
null
;
}
CColumnsMarkup
.
prototype
.
Update_FromSectPr
=
function
(
SectPr
)
CColumnsMarkup
.
prototype
.
Update_FromSectPr
=
function
(
SectPr
)
{
if
(
!
SectPr
)
return
;
...
...
@@ -89,11 +102,11 @@ CColumnsMarkup.prototype.Update_FromSectPr = function(SectPr)
this
.
Cols
[
Index
].
Space
=
Columns
.
Cols
[
Index
].
Space
;
}
};
CColumnsMarkup
.
prototype
.
Set_CurCol
=
function
(
CurCol
)
CColumnsMarkup
.
prototype
.
Set_CurCol
=
function
(
CurCol
)
{
this
.
CurCol
=
CurCol
;
};
CColumnsMarkup
.
prototype
.
CreateDuplicate
=
function
()
CColumnsMarkup
.
prototype
.
CreateDuplicate
=
function
()
{
var
_ret
=
new
CColumnsMarkup
();
_ret
.
SectPr
=
this
.
SectPr
;
...
...
@@ -116,6 +129,77 @@ CColumnsMarkup.prototype.CreateDuplicate = function()
}
return
_ret
;
};
function
CColumnsMarkupColumn
()
{
this
.
W
=
0
;
this
.
Space
=
0
;
}
function
CColumnsMarkup
()
{
this
.
CurCol
=
0
;
this
.
X
=
0
;
// левое поле
this
.
R
=
0
;
// правое поле
this
.
EqualWidth
=
true
;
this
.
Num
=
1
;
this
.
Space
=
30
;
this
.
Cols
=
[];
this
.
SectPr
=
null
;
}
CColumnsMarkup
.
prototype
.
Update_FromSectPr
=
function
(
SectPr
)
{
if
(
!
SectPr
)
return
;
this
.
SectPr
=
SectPr
;
var
Columns
=
SectPr
.
Columns
;
this
.
X
=
SectPr
.
Get_PageMargin_Left
();
this
.
R
=
SectPr
.
Get_PageWidth
()
-
SectPr
.
Get_PageMargin_Right
();
this
.
EqualWidth
=
Columns
.
EqualWidth
;
this
.
Num
=
Columns
.
Num
;
this
.
Space
=
Columns
.
Space
;
this
.
Cols
=
[];
for
(
var
Index
=
0
,
Count
=
Columns
.
Cols
.
length
;
Index
<
Count
;
++
Index
)
{
this
.
Cols
[
Index
]
=
new
CColumnsMarkupColumn
();
this
.
Cols
[
Index
].
W
=
Columns
.
Cols
[
Index
].
W
;
this
.
Cols
[
Index
].
Space
=
Columns
.
Cols
[
Index
].
Space
;
}
};
CColumnsMarkup
.
prototype
.
Set_CurCol
=
function
(
CurCol
)
{
this
.
CurCol
=
CurCol
;
};
CColumnsMarkup
.
prototype
.
CreateDuplicate
=
function
()
{
var
_ret
=
new
CColumnsMarkup
();
_ret
.
SectPr
=
this
.
SectPr
;
_ret
.
CurCol
=
this
.
CurCol
;
_ret
.
X
=
this
.
X
;
_ret
.
R
=
this
.
R
;
_ret
.
EqualWidth
=
this
.
EqualWidth
;
_ret
.
Num
=
this
.
Num
;
_ret
.
Space
=
this
.
Space
;
_ret
.
Cols
=
[];
for
(
var
i
=
0
;
i
<
this
.
Cols
.
length
;
i
++
)
{
var
_col
=
new
CColumnsMarkupColumn
();
_col
.
W
=
this
.
Cols
[
i
].
W
;
_col
.
Space
=
this
.
Cols
[
i
].
Space
;
_ret
.
Cols
.
push
(
_col
);
}
return
_ret
;
};
function
CTableOutlineDr
()
{
this
.
image
=
{};
...
...
@@ -563,20 +647,6 @@ CDrawingCollaborativeTarget.prototype =
{
CheckPosition
:
function
(
_drawing_doc
,
_x
,
_y
,
_size
,
_page
,
_transform
)
{
// 1) создаем новый элемент, если еще его не было
// var bIsHtmlElementCreate = false;
// if (this.HtmlElement == null)
// {
// bIsHtmlElementCreate = true;
// this.HtmlElement = document.createElement('canvas');
// this.HtmlElement.style.cssText = "pointer-events: none;position:absolute;padding:0;margin:0;-webkit-user-select:none;width:1px;height:1px;display:block;z-index:3;";
// this.HtmlElement.width = 1;
// this.HtmlElement.height = 1;
//
// this.Color = AscCommon.getUserColorById(this.ShortId, null, true);
// this.Style = "rgb(" + this.Color.r + "," + this.Color.g + "," + this.Color.b + ")";
// }
//
// 2) определяем размер
this
.
Transform
=
_transform
;
this
.
Size
=
_size
;
...
...
@@ -588,152 +658,16 @@ CDrawingCollaborativeTarget.prototype =
this
.
X
=
_x
;
this
.
Y
=
_y
;
this
.
Page
=
_page
;
// var _oldW = this.HtmlElement.width;
// var _oldH = this.HtmlElement.height;
//
// var _newW = 2;
// var _newH = (this.Size * _drawing_doc.m_oWordControl.m_nZoomValue * g_dKoef_mm_to_pix / 100) >> 0;
//
// if (null != this.Transform && !global_MatrixTransformer.IsIdentity2(this.Transform))
// {
// var _x1 = this.Transform.TransformPointX(_x, _y);
// var _y1 = this.Transform.TransformPointY(_x, _y);
//
// var _x2 = this.Transform.TransformPointX(_x, _y + this.Size);
// var _y2 = this.Transform.TransformPointY(_x, _y + this.Size);
//
// var pos1 = _drawing_doc.ConvertCoordsToCursor2(_x1, _y1, this.Page);
// var pos2 = _drawing_doc.ConvertCoordsToCursor2(_x2, _y2, this.Page);
//
// _newW = (Math.abs(pos1.X - pos2.X) >> 0) + 1;
// _newH = (Math.abs(pos1.Y - pos2.Y) >> 0) + 1;
//
// if (2 > _newW)
// _newW = 2;
// if (2 > _newH)
// _newH = 2;
//
// if (_oldW == _newW && _oldH == _newH)
// {
// if (_newW != 2 && _newH != 2)
// {
// // просто очищаем
// this.HtmlElement.width = _newW;
// }
// }
// else
// {
// this.HtmlElement.style.width = _newW + "px";
// this.HtmlElement.style.height = _newH + "px";
//
// this.HtmlElement.width = _newW;
// this.HtmlElement.height = _newH;
// }
// var ctx = this.HtmlElement.getContext('2d');
//
// if (_newW == 2 || _newH == 2)
// {
// ctx.fillStyle = this.Style;
// ctx.fillRect(0, 0, _newW, _newH);
// }
// else
// {
// ctx.beginPath();
// ctx.strokeStyle = this.Style;
// ctx.lineWidth = 2;
//
// if (((pos1.X - pos2.X) * (pos1.Y - pos2.Y)) >= 0)
// {
// ctx.moveTo(0, 0);
// ctx.lineTo(_newW, _newH);
// }
// else
// {
// ctx.moveTo(0, _newH);
// ctx.lineTo(_newW, 0);
// }
//
// ctx.stroke();
// }
//
// this.HtmlElementX = Math.min(pos1.X, pos2.X) >> 0;
// this.HtmlElementY = Math.min(pos1.Y, pos2.Y) >> 0;
// if ((!_drawing_doc.m_oWordControl.MobileTouchManager && !AscCommon.AscBrowser.isSafariMacOs) || !AscCommon.AscBrowser.isWebkit)
// {
// this.HtmlElement.style.left = this.HtmlElementX + "px";
// this.HtmlElement.style.top = this.HtmlElementY + "px";
// }
// else
// {
// this.HtmlElement.style.left = "0px";
// this.HtmlElement.style.top = "0px";
// this.HtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " + this.HtmlElementX + "," + this.HtmlElementY + ")";
// }
// }
// else
// {
// if (_oldW == _newW && _oldH == _newH)
// {
// // просто очищаем
// this.HtmlElement.width = _newW;
// }
// else
// {
// this.HtmlElement.style.width = _newW + "px";
// this.HtmlElement.style.height = _newH + "px";
//
// this.HtmlElement.width = _newW;
// this.HtmlElement.height = _newH;
// }
//
// var ctx = this.HtmlElement.getContext('2d');
//
// ctx.fillStyle = this.Style;
// ctx.fillRect(0, 0, _newW, _newH);
//
// if (null != this.Transform)
// {
// _x += this.Transform.tx;
// _y += this.Transform.ty;
// }
//
// var pos = _drawing_doc.ConvertCoordsToCursor2(_x, _y, this.Page);
//
// this.HtmlElementX = pos.X >> 0;
// this.HtmlElementY = pos.Y >> 0;
//
// if ((!_drawing_doc.m_oWordControl.MobileTouchManager && !AscCommon.AscBrowser.isSafariMacOs) || !AscCommon.AscBrowser.isWebkit)
// {
// this.HtmlElement.style.left = this.HtmlElementX + "px";
// this.HtmlElement.style.top = this.HtmlElementY + "px";
// }
// else
// {
// this.HtmlElement.style.left = "0px";
// this.HtmlElement.style.top = "0px";
// this.HtmlElement.style["webkitTransform"] = "matrix(1, 0, 0, 1, " + this.HtmlElementX + "," + this.HtmlElementY + ")";
// }
// }
//
// if (AscCommon.CollaborativeEditing)
// AscCommon.CollaborativeEditing.Update_ForeignCursorLabelPosition(this.Id, this.HtmlElementX, this.HtmlElementY, this.Color);
//
// // 3) добавить, если нужно
// if (bIsHtmlElementCreate)
// {
// _drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement);
// }
},
Remove
:
function
(
_drawing_doc
)
{
//_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement);
},
Update
:
function
(
_drawing_doc
)
{
//this.CheckPosition(_drawing_doc, this.X, this.Y, this.Size, this.Page, this.Transform);
}
};
...
...
@@ -1076,6 +1010,20 @@ CDrawingDocument.prototype =
}
},
ContentControlsSaveLast
:
function
()
{},
ContentControlsCheckLast
:
function
()
{
return
false
;
},
DrawContentControlsTrack
:
function
(
overlay
)
{},
OnDrawContentControl
:
function
(
id
,
type
,
rects
,
transform
)
{},
// current page
SetCurrentPage
:
function
(
PageIndex
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment