Commit 11e0d729 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- Добавлен класс DrawingArea.js(для работы с закреплёнными областями). Нужна замена index.html

- Добавил 2 канвы для отрисовки графики
- Сделал селект в закреплённых областях
- Доработки по событиям мыши
- 3-й клик для выделения всего текста в автофигуре

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54251 954022d7-b5bf-4e40-9824-e11837661b57
parent 203469d4
This diff is collapsed.
This diff is collapsed.
......@@ -258,6 +258,8 @@ DrawingObjectsController.prototype =
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
selector.resetSelection();
selector.selectObject(object);
if(!is_selected)
this.updateOverlay();
this.checkSelectedObjectsForMove(group);
if(!isRealObject(group))
{
......
......@@ -2556,7 +2556,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
setEndPointHistory: function(){History.EndTransaction()},
asc_startAddShape: function(sPreset) {
this.isStartAddShape = true;
this.isStartAddShape = this.controller.isShapeAction = true;
var ws = this.wb.getWorksheet();
ws.objectRender.controller.startTrackNewShape(sPreset);
},
......@@ -2600,8 +2600,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
},
asc_getGraphicObjectProps: function() {
var ws = this.wb.getWorksheet();
return ws.objectRender.controller.getGraphicObjectProps();
//var ws = this.wb.getWorksheet();
//return ws.objectRender.controller.getGraphicObjectProps();
return [];
},
asc_setGraphicObjectProps: function(props) {
......
......@@ -17,7 +17,7 @@
border: 0;
}
#ws-canvas-overlay {
#ws-canvas-overlay, #ws-canvas-graphic, #ws-canvas-graphic-overlay {
border: 0;
position: absolute;
left: 0;
......
......@@ -118,6 +118,7 @@
<script type="text/javascript" src="../../../../OfficeWeb/Common/downloaderfiles.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/docscoapicommon.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/docscoapi.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Charts/DrawingArea.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Charts/DrawingObjects.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Charts/charts.js"></script>
<script type="text/javascript" src="../../../../OfficeWeb/Common/Charts/ChartsDrawer.js"></script>
......
This diff is collapsed.
......@@ -65,9 +65,7 @@
this.targetInfo = undefined;
this.isResizeMode = false;
this.isResizeModeMove = false;
// Выставляем при клике в объект(_onMouseDown)
this.isGraphicMode = false;
// Режим автозаполнения
this.isFillHandleMode = false;
this.isMoveRangeMode = false;
......@@ -80,7 +78,10 @@
// Обработчик кликов для граф.объектов
this.clickCounter = new ClickCounter();
this.isLocked = false;
this.isMousePressed = false;
this.isShapeAction = false;
// Для обработки _onMouseUp и _onWindowMouseUp
this.isMouseDownMode = false;
// Был ли DblClick обработан в onMouseDown эвенте
this.isDblClickInMouseDown = false;
......@@ -284,7 +285,7 @@
var coord = t._getCoordinates(event);
var graphicsInfo = t.handlers.trigger("getGraphicsInfo", coord.x, coord.y);
if ( asc["editor"].isStartAddShape || (graphicsInfo && graphicsInfo.isGraphicObject) )
if ( t.isShapeAction || graphicsInfo )
return;
setTimeout(function () {
......@@ -614,7 +615,7 @@
t.__retval = true;
//for Mac OS
// Mac OS
if ( event.metaKey )
event.ctrlKey = true;
......@@ -632,14 +633,9 @@
}
var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects");
if ( !t.isLocked && graphicObjects.length && t.enableKeyEvents ) {
var result = t.handlers.trigger("graphicObjectWindowKeyDown", event);
if (t.isCellEditMode) {
t.handlers.trigger("stopCellEditing");
t.isCellEditMode = false;
}
if (result)
return result;
if ( !t.isMousePressed && graphicObjects.length && t.enableKeyEvents ) {
if (t.handlers.trigger("graphicObjectWindowKeyDown", event))
return true;
}
// Двигаемся ли мы в выделенной области
......@@ -947,15 +943,14 @@
if (t.settings.isViewerMode || t.isSelectionDialogMode) {return true;}
var graphicObjects = t.handlers.trigger("getSelectedGraphicObjects");
if ( !t.isLocked && graphicObjects.length && t.enableKeyEvents ) {
if ( !t.isMousePressed && graphicObjects.length && t.enableKeyEvents ) {
if (!( (event.ctrlKey || event.metaKey) && (event.which == 99 || event.which == 118 || event.which == 120) )) { // Mozilla Firefox Fix #20080 (Ctrl+C, Ctrl+V, Ctrl+X)
if (t.handlers.trigger("graphicObjectWindowKeyPress", event)) {
if (t.isCellEditMode) {
t.handlers.trigger("stopCellEditing");
t.isCellEditMode = false;
}
return true;
if (t.isCellEditMode) {
t.handlers.trigger("stopCellEditing");
t.isCellEditMode = false;
}
if (t.handlers.trigger("graphicObjectWindowKeyPress", event))
return true;
}
}
......@@ -1013,8 +1008,8 @@
else if( this.vsbApiLockMouse )
this.vsbApi.mouseDown ? this.vsbApi.evt_mousemove.call(this.vsbApi,event) : false;
event.isLocked = t.isLocked;
if (asc["editor"].isStartAddShape && t.isGraphicMode)
event.isLocked = t.isMousePressed;
if (t.isShapeAction && t.isMouseDownMode)
t.handlers.trigger("graphicObjectMouseMove", event, coord.x, coord.y);
return true;
......@@ -1023,17 +1018,15 @@
/** @param event {jQuery.Event} */
asc_CEventsController.prototype._onWindowMouseUp = function (event) {
// this.vsbApi.evt_mouseup(event);
// this.hsbApi.evt_mouseup(event);
// this.vsbApi.evt_mouseup(event);
// this.hsbApi.evt_mouseup(event);
// Shapes
var coord = this._getCoordinates(event);
// Отправляем событие только вне канвы
if ( this.isGraphicMode && asc["editor"].isStartAddShape ) {
this.isLocked = false;
event.isLocked = false;
this.isGraphicMode = false;
// Shapes
if ( this.isMouseDownMode && this.isShapeAction ) {
event.isLocked = this.isMousePressed = false;
this.isMouseDownMode = false;
event.ClickCount = this.clickCounter.clickCount;
this.handlers.trigger("graphicObjectMouseUp", event, coord.x, coord.y);
this._changeSelectionDone(event);
......@@ -1144,8 +1137,7 @@
asc_CEventsController.prototype._onMouseDown = function (event) {
var t = this;
var coord = t._getCoordinates(event);
event.isLocked = true;
t.isLocked = true;
event.isLocked = t.isMousePressed = true;
if (t.handlers.trigger("isGlobalLockEditCell"))
return;
......@@ -1156,33 +1148,30 @@
// Shapes
var graphicsInfo = t.handlers.trigger("getGraphicsInfo", coord.x, coord.y);
if ( asc["editor"].isStartAddShape || (graphicsInfo && graphicsInfo.isGraphicObject) ) {
if ( asc["editor"].isStartAddShape || graphicsInfo ) {
// При выборе диапазона не нужно выделять автофигуру
if (t.isSelectionDialogMode)
return;
if ( t.isCellEditMode )
t.handlers.trigger("stopCellEditing");
t.isShapeAction = true;
t.isMouseDownMode = true;
//for Mac OS
if (event.metaKey)
// Mac OS
if ( event.metaKey )
event.ctrlKey = true;
this.clickCounter.mouseDownEvent(coord.x, coord.y, event.button);
event.ClickCount = this.clickCounter.clickCount;
if ( (event.ClickCount == 2) && asc["editor"].isStartAddShape )
this.isDblClickInMouseDown = true;
asc["editor"].isStartAddShape = true;
t.clickCounter.mouseDownEvent(coord.x, coord.y, event.button);
event.ClickCount = t.clickCounter.clickCount;
if ( (event.ClickCount == 2) && t.isShapeAction )
t.isDblClickInMouseDown = true;
t.handlers.trigger("graphicObjectMouseDown", event, coord.x, coord.y);
t.isGraphicMode = true;
if (asc["editor"].isStartAddShape) {
// SelectionChanged
t.handlers.trigger("updateSelectionShape", /*isSelectOnShape*/true);
return;
}
t.handlers.trigger("updateSelectionShape", /*isSelectOnShape*/true);
return;
}
else
t.isShapeAction = false;
if (2 === event.detail) {
// Это означает, что это MouseDown для dblClick эвента (его обрабатывать не нужно)
......@@ -1310,22 +1299,20 @@
// Shapes
var coord = this._getCoordinates(event);
event.isLocked = false;
this.isLocked = false;
this.handlers.trigger("graphicObjectMouseUpEx", event, coord.x, coord.y);
if ( asc["editor"].isStartAddShape ) {
event.isLocked = this.isMousePressed = false;
//for Mac OS
if ( this.isShapeAction ) {
// Mac OS
if ( event.metaKey )
event.ctrlKey = true;
//console.log("_onMouseUp: " + this.clickCounter.clickCount);
if (this.isCellEditMode) {
this.handlers.trigger("stopCellEditing");
this.isCellEditMode = false;
}
event.ClickCount = this.clickCounter.clickCount;
this.handlers.trigger("graphicObjectMouseUp", event, coord.x, coord.y);
this._changeSelectionDone(event);
this.isGraphicMode = false;
this.isMouseDownMode = false;
return true;
}
......@@ -1365,13 +1352,13 @@
asc_CEventsController.prototype._onMouseMove = function (event) {
var t = this;
var coord = t._getCoordinates(event);
event.isLocked = t.isLocked;
event.isLocked = t.isMousePressed;
t.hasCursor = true;
// Shapes
var graphicsInfo = t.handlers.trigger("getGraphicsInfo", coord.x, coord.y);
if ( graphicsInfo && graphicsInfo.isGraphicObject )
if ( graphicsInfo )
this.clickCounter.mouseMoveEvent(coord.x, coord.y);
if (t.isSelectMode) {
......@@ -1408,7 +1395,7 @@
return true;
}
if (asc["editor"].isStartAddShape || graphicsInfo) {
if (t.isShapeAction || graphicsInfo) {
t.handlers.trigger("graphicObjectMouseMove", event, coord.x, coord.y);
t.handlers.trigger("updateWorksheet", t.element, coord.x, coord.y, event.ctrlKey, function(info){t.targetInfo = info;});
return true;
......
......@@ -77,6 +77,8 @@
//----- declaration -----
this.canvas = undefined;
this.canvasOverlay = undefined;
this.canvasGraphic = undefined;
this.canvasGraphicOverlay = undefined;
this.wsActive = -1;
this.wsViews = [];
this.cellEditor = undefined;
......@@ -100,6 +102,8 @@
this.buffers = {};
this.drawingCtx = undefined;
this.overlayCtx = undefined;
this.drawingGraphicCtx = undefined;
this.overlayGraphicCtx = undefined;
this.stringRender = undefined;
this.drawingCtxCharts = undefined;
......@@ -140,31 +144,39 @@
this.element.innerHTML = '<div id="ws-canvas-outer">\
<canvas id="ws-canvas"></canvas>\
<canvas id="ws-canvas-overlay"></canvas>\
<canvas id="ws-canvas-graphic"></canvas>\
<canvas id="ws-canvas-graphic-overlay"></canvas>\
<canvas id="id_target_cursor" class="block_elem" width="1" height="1"\
style="width:2px;height:13px;display:none;z-index:1004;"></canvas>\
</div>';
this.canvas = document.getElementById("ws-canvas");
this.canvasOverlay = document.getElementById("ws-canvas-overlay");
this.canvasGraphic = document.getElementById("ws-canvas-graphic");
this.canvasGraphicOverlay = document.getElementById("ws-canvas-graphic-overlay");
this._canResize();
}
this.buffers.main = asc_DC({canvas: this.canvas, units: 1/*pt*/,
fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlay = asc_DC({canvas: this.canvasOverlay, units: 1/*pt*/,
fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.main = asc_DC({canvas: this.canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlay = asc_DC({canvas: this.canvasOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlay.ctx.isOverlay = true; // Для разруливания _activateOverlayCtx / _deactivateOverlayCtx
this.buffers.mainGraphic = asc_DC({canvas: this.canvasGraphic, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.buffers.overlayGraphic = asc_DC({canvas: this.canvasGraphicOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
this.drawingCtx = this.buffers.main;
this.overlayCtx = this.buffers.overlay;
this.drawingGraphicCtx = this.buffers.mainGraphic;
this.overlayGraphicCtx = this.buffers.overlayGraphic;
// Shapes
this.buffers.shapeCtx = new CGraphics();
this.buffers.shapeCtx.init(this.drawingCtx.ctx, this.drawingCtx.getWidth(0), this.drawingCtx.getHeight(0), this.drawingCtx.getWidth(3), this.drawingCtx.getHeight(3));
this.buffers.shapeCtx.init(this.drawingGraphicCtx.ctx, this.drawingGraphicCtx.getWidth(0), this.drawingGraphicCtx.getHeight(0), this.drawingGraphicCtx.getWidth(3), this.drawingGraphicCtx.getHeight(3));
this.buffers.shapeCtx.m_oFontManager = this.fmgrGraphics[2];
this.buffers.shapeOverlayCtx = new CGraphics();
this.buffers.shapeOverlayCtx.init(this.overlayCtx.ctx, this.overlayCtx.getWidth(0), this.overlayCtx.getHeight(0), this.overlayCtx.getWidth(3), this.overlayCtx.getHeight(3));
this.buffers.shapeOverlayCtx.init(this.overlayGraphicCtx.ctx, this.overlayGraphicCtx.getWidth(0), this.overlayGraphicCtx.getHeight(0), this.overlayGraphicCtx.getWidth(3), this.overlayGraphicCtx.getHeight(3));
this.buffers.shapeOverlayCtx.m_oFontManager = this.fmgrGraphics[2];
this.drawingCtxCharts = asc_DC({units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont});
......@@ -177,7 +189,7 @@
if (!window["NATIVE_EDITOR_ENJINE"]) {
// initialize events controller
this.controller.init(this, this.element, this.canvasOverlay, /*handlers*/{
this.controller.init(this, this.element, /*this.canvasOverlay*/ this.canvasGraphicOverlay, /*handlers*/{
"resize": function () {self.resize.apply(self, arguments);},
"reinitializeScroll": function () {self._onScrollReinitialize.apply(self, arguments);},
"scrollY": function () {self._onScrollY.apply(self, arguments);},
......@@ -1170,8 +1182,8 @@
if (oldWidth === width && oldHeight === height)
return false;
this.canvas.width = this.canvasOverlay.width = width;
this.canvas.height = this.canvasOverlay.height = height;
this.canvas.width = this.canvasOverlay.width = this.canvasGraphic.width = this.canvasGraphicOverlay.width = width;
this.canvas.height = this.canvasOverlay.height = this.canvasGraphic.height = this.canvasGraphicOverlay.height = height;
// При смене ориентации у планшета, сбрасываются флаги у canvas!
this.drawingCtx.initContextSmoothing();
......@@ -1207,6 +1219,8 @@
this.buffers.main.changeZoom(factor);
this.buffers.overlay.changeZoom(factor);
this.buffers.mainGraphic.changeZoom(factor);
this.buffers.overlayGraphic.changeZoom(factor);
this.drawingCtxCharts.changeZoom(factor);
var item;
......
......@@ -304,6 +304,10 @@
this.buffers = buffers;
this.drawingCtx = this.buffers.main;
this.overlayCtx = this.buffers.overlay;
this.drawingGraphicCtx = this.buffers.mainGraphic;
this.overlayGraphicCtx = this.buffers.overlayGraphic;
this.shapeCtx = this.buffers.shapeCtx;
this.shapeOverlayCtx = this.buffers.shapeOverlayCtx;
......@@ -2876,9 +2880,9 @@
};
/** Рисует закрепление областей */
WorksheetView.prototype._drawFrozenPaneLines = function () {
WorksheetView.prototype._drawFrozenPaneLines = function (canvas) {
if (this.topLeftFrozenCell) {
var ctx = this.drawingCtx;
var ctx = canvas ? canvas : this.drawingCtx;
var row = this.topLeftFrozenCell.getRow0();
var col = this.topLeftFrozenCell.getCol0();
ctx.setLineWidth(1).setStrokeStyle(this.settings.frozenColor).beginPath();
......
......@@ -106,8 +106,8 @@ function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit, bFrom
this.Lock = new CLock(); // Зажат ли данный параграф другим пользователем
if ( false === g_oIdCounter.m_bLoad )
{
this.Lock.Set_Type( locktype_Mine, false );
CollaborativeEditing.Add_Unlock2( this );
//this.Lock.Set_Type( locktype_Mine, false );
//CollaborativeEditing.Add_Unlock2( this );
}
this.DeleteCollaborativeMarks = true;
......
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