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
fbed8d82
Commit
fbed8d82
authored
Mar 17, 2016
by
Alexey Musinov
Committed by
KirillovIlya
Mar 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DrawingArea _this -> prototype
parent
ea52adf6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
144 additions
and
147 deletions
+144
-147
Common/Charts/DrawingArea.js
Common/Charts/DrawingArea.js
+144
-147
No files found.
Common/Charts/DrawingArea.js
100644 → 100755
View file @
fbed8d82
...
...
@@ -565,72 +565,70 @@ function FrozenPlace(ws, type) {
// Container
function
DrawingArea
(
ws
)
{
var
_this
=
this
;
var
asc
=
window
[
"
Asc
"
];
var
api
=
asc
[
"
editor
"
];
this
.
api
=
asc
[
"
editor
"
];
_this
.
worksheet
=
ws
;
_this
.
frozenPlaces
=
[];
this
.
worksheet
=
ws
;
this
.
frozenPlaces
=
[];
}
// Methods
_this
.
init
=
function
()
{
_this
.
frozenPlaces
=
[];
if
(
_this
.
worksheet
)
{
DrawingArea
.
prototype
.
init
=
function
()
{
this
.
frozenPlaces
=
[];
if
(
this
.
worksheet
)
{
var
place
;
if
(
_
this
.
worksheet
.
topLeftFrozenCell
)
{
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
Top
);
if
(
this
.
worksheet
.
topLeftFrozenCell
)
{
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
Top
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
Bottom
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
Bottom
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
Left
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
Left
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
Right
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
Right
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
LeftTop
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
LeftTop
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
RightTop
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
RightTop
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
LeftBottom
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
LeftBottom
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
RightBottom
);
this
.
frozenPlaces
.
push
(
place
);
place
=
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
RightBottom
);
if
(
place
.
isValid
)
_
this
.
frozenPlaces
.
push
(
place
);
this
.
frozenPlaces
.
push
(
place
);
}
else
_this
.
frozenPlaces
.
push
(
new
FrozenPlace
(
_
this
.
worksheet
,
FrozenAreaType
.
Center
));
this
.
frozenPlaces
.
push
(
new
FrozenPlace
(
this
.
worksheet
,
FrozenAreaType
.
Center
));
}
};
};
_this
.
clear
=
function
()
{
_
this
.
worksheet
.
drawingGraphicCtx
.
clear
();
};
DrawingArea
.
prototype
.
clear
=
function
()
{
this
.
worksheet
.
drawingGraphicCtx
.
clear
();
};
_this
.
drawObject
=
function
(
object
)
{
for
(
var
i
=
0
;
i
<
_
this
.
frozenPlaces
.
length
;
i
++
)
{
if
(
_
this
.
frozenPlaces
[
i
].
isObjectInside
(
object
)
)
{
_
this
.
frozenPlaces
[
i
].
drawObject
(
object
);
DrawingArea
.
prototype
.
drawObject
=
function
(
object
)
{
for
(
var
i
=
0
;
i
<
this
.
frozenPlaces
.
length
;
i
++
)
{
if
(
this
.
frozenPlaces
[
i
].
isObjectInside
(
object
)
)
{
this
.
frozenPlaces
[
i
].
drawObject
(
object
);
}
}
};
};
_this
.
reinitRanges
=
function
()
{
for
(
var
i
=
0
;
i
<
_this
.
frozenPlaces
.
length
;
i
++
)
{
_this
.
frozenPlaces
[
i
].
initRange
();
DrawingArea
.
prototype
.
reinitRanges
=
function
()
{
for
(
var
i
=
0
;
i
<
this
.
frozenPlaces
.
length
;
i
++
)
{
this
.
frozenPlaces
[
i
].
initRange
();
}
};
};
_this
.
drawSelection
=
function
(
drawingDocument
)
{
DrawingArea
.
prototype
.
drawSelection
=
function
(
drawingDocument
)
{
var
canvas
=
_
this
.
worksheet
.
objectRender
.
getDrawingCanvas
();
var
canvas
=
this
.
worksheet
.
objectRender
.
getDrawingCanvas
();
var
shapeCtx
=
canvas
.
shapeCtx
;
var
shapeOverlayCtx
=
canvas
.
shapeOverlayCtx
;
var
autoShapeTrack
=
canvas
.
autoShapeTrack
;
...
...
@@ -640,30 +638,30 @@ function DrawingArea(ws) {
trackOverlay
.
Clear
();
drawingDocument
.
Overlay
=
trackOverlay
;
_
this
.
worksheet
.
overlayCtx
.
clear
();
_
this
.
worksheet
.
overlayGraphicCtx
.
clear
();
_
this
.
worksheet
.
_drawCollaborativeElements
();
this
.
worksheet
.
overlayCtx
.
clear
();
this
.
worksheet
.
overlayGraphicCtx
.
clear
();
this
.
worksheet
.
_drawCollaborativeElements
();
if
(
!
_this
.
worksheet
.
objectRender
.
controller
.
selectedObjects
.
length
&&
!
api
.
isStartAddShape
)
_
this
.
worksheet
.
_drawSelection
();
if
(
!
this
.
worksheet
.
objectRender
.
controller
.
selectedObjects
.
length
&&
!
this
.
api
.
isStartAddShape
)
this
.
worksheet
.
_drawSelection
();
var
chart
;
var
controller
=
_
this
.
worksheet
.
objectRender
.
controller
;
var
controller
=
this
.
worksheet
.
objectRender
.
controller
;
var
selected_objects
=
controller
.
selection
.
groupSelection
?
controller
.
selection
.
groupSelection
.
selectedObjects
:
controller
.
selectedObjects
;
if
(
selected_objects
.
length
===
1
&&
selected_objects
[
0
].
getObjectType
()
===
historyitem_type_ChartSpace
)
{
chart
=
selected_objects
[
0
];
_
this
.
worksheet
.
objectRender
.
selectDrawingObjectRange
(
chart
);
this
.
worksheet
.
objectRender
.
selectDrawingObjectRange
(
chart
);
//shapeOverlayCtx.ClearMode = true;
////selected_objects[0].draw(shapeOverlayCtx);
//shapeOverlayCtx.ClearMode = false;
}
for
(
var
i
=
0
;
i
<
_
this
.
frozenPlaces
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
frozenPlaces
.
length
;
i
++
)
{
_
this
.
frozenPlaces
[
i
].
setTransform
(
shapeCtx
,
shapeOverlayCtx
,
autoShapeTrack
);
this
.
frozenPlaces
[
i
].
setTransform
(
shapeCtx
,
shapeOverlayCtx
,
autoShapeTrack
);
// Clip
_
this
.
frozenPlaces
[
i
].
clip
(
shapeOverlayCtx
);
this
.
frozenPlaces
[
i
].
clip
(
shapeOverlayCtx
);
if
(
null
==
drawingDocument
.
m_oDocumentRenderer
)
{
if
(
drawingDocument
.
m_bIsSelection
)
{
...
...
@@ -674,17 +672,17 @@ function DrawingArea(ws) {
trackOverlay
.
m_oContext
=
trackOverlay
.
m_oControl
.
HtmlElement
.
getContext
(
'
2d
'
);
}
drawingDocument
.
private_StartDrawSelection
(
trackOverlay
);
_
this
.
worksheet
.
objectRender
.
controller
.
drawTextSelection
();
this
.
worksheet
.
objectRender
.
controller
.
drawTextSelection
();
drawingDocument
.
private_EndDrawSelection
();
}
ctx
.
globalAlpha
=
1.0
;
_
this
.
worksheet
.
objectRender
.
controller
.
drawSelection
(
drawingDocument
);
if
(
_
this
.
worksheet
.
objectRender
.
controller
.
needUpdateOverlay
()
)
{
this
.
worksheet
.
objectRender
.
controller
.
drawSelection
(
drawingDocument
);
if
(
this
.
worksheet
.
objectRender
.
controller
.
needUpdateOverlay
()
)
{
trackOverlay
.
Show
();
shapeOverlayCtx
.
put_GlobalAlpha
(
true
,
0.5
);
_
this
.
worksheet
.
objectRender
.
controller
.
drawTracks
(
shapeOverlayCtx
);
this
.
worksheet
.
objectRender
.
controller
.
drawTracks
(
shapeOverlayCtx
);
shapeOverlayCtx
.
put_GlobalAlpha
(
true
,
1
);
}
}
...
...
@@ -704,16 +702,15 @@ function DrawingArea(ws) {
}
// Restore
_
this
.
frozenPlaces
[
i
].
restore
(
shapeOverlayCtx
);
this
.
frozenPlaces
[
i
].
restore
(
shapeOverlayCtx
);
}
};
};
_this
.
getOffsets
=
function
(
x
,
y
,
bEvents
)
{
for
(
var
i
=
0
;
i
<
_
this
.
frozenPlaces
.
length
;
i
++
)
{
if
(
_
this
.
frozenPlaces
[
i
].
isPointInside
(
x
,
y
,
bEvents
)
)
{
return
{
x
:
_this
.
frozenPlaces
[
i
].
getHorizontalScroll
(),
y
:
_
this
.
frozenPlaces
[
i
].
getVerticalScroll
()
}
DrawingArea
.
prototype
.
getOffsets
=
function
(
x
,
y
,
bEvents
)
{
for
(
var
i
=
0
;
i
<
this
.
frozenPlaces
.
length
;
i
++
)
{
if
(
this
.
frozenPlaces
[
i
].
isPointInside
(
x
,
y
,
bEvents
)
)
{
return
{
x
:
this
.
frozenPlaces
[
i
].
getHorizontalScroll
(),
y
:
this
.
frozenPlaces
[
i
].
getVerticalScroll
()
}
}
}
return
null
;
};
\ No newline at end of file
}
\ No newline at end of file
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