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
b1612b73
Commit
b1612b73
authored
Sep 25, 2017
by
Alexey.Musinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add images fixed
parent
343aa07e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
39 deletions
+28
-39
cell/native/native.js
cell/native/native.js
+28
-39
No files found.
cell/native/native.js
View file @
b1612b73
...
@@ -4823,99 +4823,88 @@ function OfflineEditor () {
...
@@ -4823,99 +4823,88 @@ function OfflineEditor () {
if
(
imageUrl
&&
!
objectRender
.
isViewerMode
())
{
if
(
imageUrl
&&
!
objectRender
.
isViewerMode
())
{
var
_image
=
_api
.
ImageLoader
.
LoadImage
(
imageUrl
,
1
);
var
_image
=
new
Image
();
_image
.
src
=
imageUrl
var
isOption
=
true
;
//options && options.cell;
var
isOption
=
true
;
//options && options.cell;
var
calculateObjectMetrics
=
function
(
object
,
width
,
height
)
{
var
calculateObjectMetrics
=
function
(
object
,
width
,
height
)
{
// Обработка картинок большого разрешения
// Обработка картинок большого разрешения
var
metricCoeff
=
1
;
var
metricCoeff
=
1
;
var
coordsFrom
=
_this
.
coordsManager
.
calculateCoords
(
object
.
from
);
var
coordsFrom
=
_this
.
coordsManager
.
calculateCoords
(
object
.
from
);
var
realTopOffset
=
coordsFrom
.
y
;
var
realTopOffset
=
coordsFrom
.
y
;
var
realLeftOffset
=
coordsFrom
.
x
;
var
realLeftOffset
=
coordsFrom
.
x
;
var
areaWidth
=
worksheet
.
getCellLeft
(
worksheet
.
getLastVisibleCol
(),
0
)
-
worksheet
.
getCellLeft
(
worksheet
.
getFirstVisibleCol
(
true
),
0
);
// по ширине
var
areaWidth
=
worksheet
.
getCellLeft
(
worksheet
.
getLastVisibleCol
(),
0
)
-
worksheet
.
getCellLeft
(
worksheet
.
getFirstVisibleCol
(
true
),
0
);
// по ширине
if
(
areaWidth
<
width
)
{
if
(
areaWidth
<
width
)
{
metricCoeff
=
width
/
areaWidth
;
metricCoeff
=
width
/
areaWidth
;
width
=
areaWidth
;
width
=
areaWidth
;
height
/=
metricCoeff
;
height
/=
metricCoeff
;
}
}
var
areaHeight
=
worksheet
.
getCellTop
(
worksheet
.
getLastVisibleRow
(),
0
)
-
worksheet
.
getCellTop
(
worksheet
.
getFirstVisibleRow
(
true
),
0
);
// по высоте
var
areaHeight
=
worksheet
.
getCellTop
(
worksheet
.
getLastVisibleRow
(),
0
)
-
worksheet
.
getCellTop
(
worksheet
.
getFirstVisibleRow
(
true
),
0
);
// по высоте
if
(
areaHeight
<
height
)
{
if
(
areaHeight
<
height
)
{
metricCoeff
=
height
/
areaHeight
;
metricCoeff
=
height
/
areaHeight
;
height
=
areaHeight
;
height
=
areaHeight
;
width
/=
metricCoeff
;
width
/=
metricCoeff
;
}
}
var
findVal
=
pxToPt
(
realLeftOffset
+
width
);
var
findVal
=
pxToPt
(
realLeftOffset
+
width
);
var
toCell
=
worksheet
.
findCellByXY
(
findVal
,
0
,
true
,
false
,
true
);
var
toCell
=
worksheet
.
findCellByXY
(
findVal
,
0
,
true
,
false
,
true
);
while
(
toCell
.
col
===
null
&&
worksheet
.
cols
.
length
<
AscCommon
.
gc_nMaxCol
)
{
while
(
toCell
.
col
===
null
&&
worksheet
.
cols
.
length
<
gc_nMaxCol
)
{
worksheet
.
expandColsOnScroll
(
true
);
worksheet
.
expandColsOnScroll
(
true
);
toCell
=
worksheet
.
findCellByXY
(
findVal
,
0
,
true
,
false
,
true
);
toCell
=
worksheet
.
findCellByXY
(
findVal
,
0
,
true
,
false
,
true
);
}
}
object
.
to
.
col
=
toCell
.
col
;
object
.
to
.
col
=
toCell
.
col
;
object
.
to
.
colOff
=
ptToMm
(
toCell
.
colOff
);
object
.
to
.
colOff
=
ptToMm
(
toCell
.
colOff
);
findVal
=
pxToPt
(
realTopOffset
+
height
);
findVal
=
pxToPt
(
realTopOffset
+
height
);
toCell
=
worksheet
.
findCellByXY
(
0
,
findVal
,
true
,
true
,
false
);
toCell
=
worksheet
.
findCellByXY
(
0
,
findVal
,
true
,
true
,
false
);
while
(
toCell
.
row
===
null
&&
worksheet
.
rows
.
length
<
AscCommon
.
gc_nMaxRow
)
{
while
(
toCell
.
row
===
null
&&
worksheet
.
rows
.
length
<
gc_nMaxRow
)
{
worksheet
.
expandRowsOnScroll
(
true
);
worksheet
.
expandRowsOnScroll
(
true
);
toCell
=
worksheet
.
findCellByXY
(
0
,
findVal
,
true
,
true
,
false
);
toCell
=
worksheet
.
findCellByXY
(
0
,
findVal
,
true
,
true
,
false
);
}
}
object
.
to
.
row
=
toCell
.
row
;
object
.
to
.
row
=
toCell
.
row
;
object
.
to
.
rowOff
=
ptToMm
(
toCell
.
rowOff
);
object
.
to
.
rowOff
=
ptToMm
(
toCell
.
rowOff
);
// worksheet.handlers.trigger("reinitializeScroll");
};
};
var
addImageObject
=
function
(
_image
)
{
var
addImageObject
=
function
(
_image
)
{
//if (!_image.Image) {
// worksheet.model.workbook.handlers.trigger("asc_onError", Asc.c_oAscError.ID.UplImageUrl, Asc.c_oAscError.Level.NoCritical);
//} else {
var
drawingObject
=
_this
.
createDrawingObject
();
var
drawingObject
=
_this
.
createDrawingObject
();
drawingObject
.
worksheet
=
worksheet
;
drawingObject
.
worksheet
=
worksheet
;
var
activeCell
=
worksheet
.
model
.
selectionRange
.
activeCell
;
var
activeCell
=
worksheet
.
model
.
selectionRange
.
activeCell
;
drawingObject
.
from
.
col
=
//isOption ? options.cell.col :
drawingObject
.
from
.
col
=
activeCell
.
col
;
activeCell
.
col
;
drawingObject
.
from
.
row
=
activeCell
.
row
;
drawingObject
.
from
.
row
=
//isOption ? options.cell.row :
activeCell
.
row
;
// Проверяем начальные координаты при вставке
// Проверяем начальные координаты при вставке
while
(
!
worksheet
.
cols
[
drawingObject
.
from
.
col
])
{
while
(
!
worksheet
.
cols
[
drawingObject
.
from
.
col
])
{
worksheet
.
expandColsOnScroll
(
true
);
worksheet
.
expandColsOnScroll
(
true
);
}
}
worksheet
.
expandColsOnScroll
(
true
);
// для colOff
worksheet
.
expandColsOnScroll
(
true
);
// для colOff
while
(
!
worksheet
.
rows
[
drawingObject
.
from
.
row
])
{
while
(
!
worksheet
.
rows
[
drawingObject
.
from
.
row
])
{
worksheet
.
expandRowsOnScroll
(
true
);
worksheet
.
expandRowsOnScroll
(
true
);
}
}
worksheet
.
expandRowsOnScroll
(
true
);
// для rowOff
worksheet
.
expandRowsOnScroll
(
true
);
// для rowOff
//calculateObjectMetrics(drawingObject, isOption ? options.width : _image.Image.width, isOption ? options.height : _image.Image.height);
calculateObjectMetrics
(
drawingObject
,
options
[
1
],
options
[
2
]);
calculateObjectMetrics
(
drawingObject
,
options
[
1
],
options
[
2
]);
var
coordsFrom
=
_this
.
coordsManager
.
calculateCoords
(
drawingObject
.
from
);
var
coordsFrom
=
_this
.
coordsManager
.
calculateCoords
(
drawingObject
.
from
);
var
coordsTo
=
_this
.
coordsManager
.
calculateCoords
(
drawingObject
.
to
);
var
coordsTo
=
_this
.
coordsManager
.
calculateCoords
(
drawingObject
.
to
);
// CImage
// CImage
_this
.
objectLocker
.
reset
();
_this
.
objectLocker
.
reset
();
_this
.
objectLocker
.
addObjectId
(
AscCommon
.
g_oIdCounter
.
Get_NewId
());
_this
.
objectLocker
.
addObjectId
(
AscCommon
.
g_oIdCounter
.
Get_NewId
());
_this
.
objectLocker
.
checkObjects
(
function
(
bLock
)
{
_this
.
objectLocker
.
checkObjects
(
function
(
bLock
)
{
if
(
bLock
!==
true
)
if
(
bLock
!==
true
)
return
;
return
;
_this
.
controller
.
resetSelection
();
_this
.
controller
.
resetSelection
();
_this
.
controller
.
addImageFromParams
(
imageUrl
,
_this
.
controller
.
addImageFromParams
(
_image
.
src
,
pxToMm
(
coordsFrom
.
x
)
+
MOVE_DELTA
,
pxToMm
(
coordsFrom
.
y
)
+
MOVE_DELTA
,
pxToMm
(
coordsTo
.
x
-
coordsFrom
.
x
),
pxToMm
(
coordsTo
.
y
-
coordsFrom
.
y
));
// _image.src,
});
pxToMm
(
coordsFrom
.
x
)
+
AscFormat
.
MOVE_DELTA
,
pxToMm
(
coordsFrom
.
y
)
+
AscFormat
.
MOVE_DELTA
,
pxToMm
(
coordsTo
.
x
-
coordsFrom
.
x
),
pxToMm
(
coordsTo
.
y
-
coordsFrom
.
y
));
});
//}
worksheet
.
setSelectionShape
(
true
);
worksheet
.
setSelectionShape
(
true
);
...
@@ -4924,7 +4913,7 @@ function OfflineEditor () {
...
@@ -4924,7 +4913,7 @@ function OfflineEditor () {
}
}
};
};
addImageObject
(
new
Image
()
);
addImageObject
(
_image
);
}
}
return
objectId
;
return
objectId
;
...
...
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