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
819ec09e
Commit
819ec09e
authored
Dec 09, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asc_addShapeOnSheet
parent
ee6d36de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
cell/api.js
cell/api.js
+11
-0
common/Charts/DrawingObjects.js
common/Charts/DrawingObjects.js
+62
-0
No files found.
cell/api.js
View file @
819ec09e
...
...
@@ -2404,6 +2404,16 @@ var editor;
this
.
handlers
.
trigger
(
"
asc_onEndAddShape
"
);
};
spreadsheet_api
.
prototype
.
asc_addShapeOnSheet
=
function
(
sPreset
)
{
if
(
this
.
wb
){
var
ws
=
this
.
wb
.
getWorksheet
();
if
(
ws
&&
ws
.
objectRender
){
ws
.
objectRender
.
addShapeOnSheet
(
sPreset
);
}
}
};
spreadsheet_api
.
prototype
.
asc_addOleObjectAction
=
function
(
sLocalUrl
,
sData
,
sApplicationId
,
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
)
{
var
_image
=
this
.
ImageLoader
.
LoadImage
(
AscCommon
.
getFullImageSrc2
(
sLocalUrl
),
1
);
...
...
@@ -3555,6 +3565,7 @@ var editor;
prot
[
"
setEndPointHistory
"
]
=
prot
.
setEndPointHistory
;
prot
[
"
asc_startAddShape
"
]
=
prot
.
asc_startAddShape
;
prot
[
"
asc_endAddShape
"
]
=
prot
.
asc_endAddShape
;
prot
[
"
asc_addShapeOnSheet
"
]
=
prot
.
asc_addShapeOnSheet
;
prot
[
"
asc_isAddAutoshape
"
]
=
prot
.
asc_isAddAutoshape
;
prot
[
"
asc_canAddShapeHyperlink
"
]
=
prot
.
asc_canAddShapeHyperlink
;
prot
[
"
asc_canGroupGraphicsObjects
"
]
=
prot
.
asc_canGroupGraphicsObjects
;
...
...
common/Charts/DrawingObjects.js
View file @
819ec09e
...
...
@@ -1648,6 +1648,68 @@ function DrawingObjects() {
// Constructor
//-----------------------------------------------------------------------------------
_this
.
addShapeOnSheet
=
function
(
sType
){
if
(
this
.
controller
){
if
(
!
_this
.
isViewerMode
())
{
var
oVisibleRange
=
worksheet
.
getVisibleRange
();
_this
.
objectLocker
.
reset
();
_this
.
objectLocker
.
addObjectId
(
AscCommon
.
g_oIdCounter
.
Get_NewId
());
_this
.
objectLocker
.
checkObjects
(
function
(
bLock
)
{
if
(
bLock
!==
true
)
return
;
_this
.
controller
.
resetSelection
();
var
activeCell
=
worksheet
.
model
.
selectionRange
.
activeCell
;
var
metrics
=
{};
metrics
.
col
=
activeCell
.
col
;
metrics
.
colOff
=
0
;
metrics
.
row
=
activeCell
.
row
;
metrics
.
rowOff
=
0
;
var
coordsFrom
=
_this
.
coordsManager
.
calculateCoords
(
metrics
);
var
ext_x
,
ext_y
;
if
(
typeof
AscFormat
.
SHAPE_EXT
[
sType
]
===
"
number
"
)
{
ext_x
=
AscFormat
.
SHAPE_EXT
[
sType
];
}
else
{
ext_x
=
25.4
;
}
if
(
typeof
AscFormat
.
SHAPE_ASPECTS
[
sType
]
===
"
number
"
)
{
var
_aspect
=
AscFormat
.
SHAPE_ASPECTS
[
sType
];
ext_y
=
ext_x
/
_aspect
;
}
else
{
ext_y
=
ext_x
;
}
History
.
Create_NewPoint
();
var
posX
=
pxToMm
(
coordsFrom
.
x
)
+
MOVE_DELTA
;
var
posY
=
pxToMm
(
coordsFrom
.
y
)
+
MOVE_DELTA
;
var
oTrack
=
new
AscFormat
.
NewShapeTrack
(
sType
,
posX
,
posY
,
_this
.
controller
.
getTheme
(),
null
,
null
,
null
,
0
);
oTrack
.
track
({},
posX
+
ext_x
,
posY
+
ext_y
);
var
oShape
=
oTrack
.
getShape
(
false
,
_this
.
drawingDocument
,
null
);
oShape
.
setWorksheet
(
worksheet
.
model
);
oShape
.
addToDrawingObjects
();
worksheet
.
setSelectionShape
(
true
);
_this
.
controller
.
startRecalculate
();
});
}
}
};
_this
.
getScrollOffset
=
function
()
{
return
scrollOffset
;
...
...
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