zoomframe: draw grids before drawing tiles
Signed-off-by: Dennis Francis <dennis.francis@collabora.com> Change-Id: I0ec0cad30c6e9742fa3e0df08a34edb4b2d877ab
This commit is contained in:
parent
1f3d5e0a3e
commit
1ac50dadd8
2 changed files with 15 additions and 6 deletions
|
@ -337,6 +337,7 @@ L.TileSectionManager = L.Class.extend({
|
|||
onDraw: that._onDrawGridSection,
|
||||
onDrawArea: that._drawGridSectionArea
|
||||
}, 'tiles'); // Its size and position will be copied from 'tiles' section.
|
||||
this._calcGridSection = this._sectionContainer.getSectionWithName(L.CSections.CalcGrid.name);
|
||||
},
|
||||
|
||||
_addOverlaySection: function () {
|
||||
|
@ -387,8 +388,12 @@ L.TileSectionManager = L.Class.extend({
|
|||
return;
|
||||
|
||||
var context = canvasCtx ? canvasCtx : this.context;
|
||||
var tsManager = this.sectionProperties.tsManager;
|
||||
context.strokeStyle = this.sectionProperties.strokeStyle;
|
||||
context.lineWidth = 1.0;
|
||||
var scale = 1.0;
|
||||
if (tsManager._inZoomAnim && tsManager._zoomFrameScale)
|
||||
scale = tsManager._zoomFrameScale;
|
||||
|
||||
var ctx = this.sectionProperties.tsManager._paintContext();
|
||||
for (var i = 0; i < ctx.paneBoundsList.length; ++i) {
|
||||
|
@ -428,8 +433,8 @@ L.TileSectionManager = L.Class.extend({
|
|||
this.sectionProperties.docLayer.sheetGeometry._columns.forEachInCorePixelRange(
|
||||
repaintArea.min.x, repaintArea.max.x,
|
||||
function(pos) {
|
||||
context.moveTo(pos - paneOffset.x - 0.5, miny - paneOffset.y + 0.5);
|
||||
context.lineTo(pos - paneOffset.x - 0.5, maxy - paneOffset.y - 0.5);
|
||||
context.moveTo(Math.floor(scale * (pos - paneOffset.x)) - 0.5, Math.floor(scale * (miny - paneOffset.y)) + 0.5);
|
||||
context.lineTo(Math.floor(scale * (pos - paneOffset.x)) - 0.5, Math.floor(scale * (maxy - paneOffset.y)) - 0.5);
|
||||
context.stroke();
|
||||
});
|
||||
|
||||
|
@ -437,8 +442,8 @@ L.TileSectionManager = L.Class.extend({
|
|||
this.sectionProperties.docLayer.sheetGeometry._rows.forEachInCorePixelRange(
|
||||
miny, maxy,
|
||||
function(pos) {
|
||||
context.moveTo(repaintArea.min.x - paneOffset.x + 0.5, pos - paneOffset.y - 0.5);
|
||||
context.lineTo(repaintArea.max.x - paneOffset.x - 0.5, pos - paneOffset.y - 0.5);
|
||||
context.moveTo(Math.floor(scale * (repaintArea.min.x - paneOffset.x)) + 0.5, Math.floor(scale * (pos - paneOffset.y)) - 0.5);
|
||||
context.lineTo(Math.floor(scale * (repaintArea.max.x - paneOffset.x)) - 0.5, Math.floor(scale * (pos - paneOffset.y)) - 0.5);
|
||||
context.stroke();
|
||||
});
|
||||
|
||||
|
@ -606,9 +611,10 @@ L.TileSectionManager = L.Class.extend({
|
|||
var canvasOverlay = this._layer._canvasOverlay;
|
||||
|
||||
var rafFunc = function (timeStamp, final) {
|
||||
// TODO: Draw grids if Calc.
|
||||
// draw zoom frame directly from the tiles.
|
||||
// Draw zoom frame with grids and directly from the tiles.
|
||||
// This will clear the doc area first.
|
||||
painter._tilesSection.drawZoomFrame(ctx);
|
||||
// Draw the overlay objects.
|
||||
canvasOverlay.onDraw();
|
||||
|
||||
if (!final)
|
||||
|
|
|
@ -468,6 +468,9 @@ class TilesSection {
|
|||
}
|
||||
|
||||
var docRange = new L.Bounds(docPos.topLeft, docPos.topLeft.add(docAreaSize));
|
||||
if (tsManager._calcGridSection) {
|
||||
tsManager._calcGridSection.onDrawArea(docRange, docRange.min.subtract(destPos), this.context);
|
||||
}
|
||||
var canvasContext = this.context;
|
||||
|
||||
this.forEachTileInArea(docRange, zoom, part, ctx, function (tile: any, coords: any): boolean {
|
||||
|
|
Loading…
Reference in a new issue