Refactoring. Create function to get current frame

This commit is contained in:
janczer 2018-09-26 17:15:03 +02:00 committed by Julian Descottes
parent 5e364e984c
commit 65f4fd0f27
2 changed files with 15 additions and 5 deletions

View File

@ -93,6 +93,11 @@
left: 1px;
}
.cursor-coordinates .frame-info {
line-height: 1.5;
text-align: left;
}
/**
* Canvases layout
*/
@ -164,4 +169,4 @@
.canvas.drawing-canvas {z-index: 8;}
.canvas.canvas-overlay {z-index: 9;}
.canvas.onion-skin-canvas {z-index: 10;}
.canvas.layers-above-canvas {z-index: 11;}
.canvas.layers-above-canvas {z-index: 11;}

View File

@ -18,6 +18,7 @@
$.subscribe(Events.DRAG_END, this.onDragEnd_.bind(this));
$.subscribe(Events.FRAME_SIZE_CHANGED, this.redraw.bind(this));
$.subscribe(Events.ZOOM_CHANGED, this.redraw.bind(this));
$.subscribe(Events.PISKEL_RESET, this.redraw.bind(this));
this.redraw();
};
@ -45,15 +46,19 @@
html += '<div class="drawing-zoom">x' + zoom + '</div>';
}
this.coordinatesContainer.innerHTML = this.getFrameSizeHTML_() + html;
this.coordinatesContainer.innerHTML = this.getFrameSizeHTML_() + html + this.getCurrentFrameIndexHTML_();
};
ns.CursorCoordinatesController.prototype.getCurrentFrameIndexHTML_ = function () {
var currentFrameIndex = this.piskelController.getCurrentFrameIndex() + 1;
var frameCount = this.piskelController.getFrameCount();
return '<div class="frame-info">' + currentFrameIndex + '/' + frameCount + '</div>';
};
ns.CursorCoordinatesController.prototype.getFrameSizeHTML_ = function () {
var w = this.piskelController.getWidth();
var h = this.piskelController.getHeight();
var currentFrameIndex = this.piskelController.getCurrentFrameIndex() + 1;
var frameCount = this.piskelController.getFrameCount();
return '[' + w + 'x' + h + '] ' + currentFrameIndex + '/' + frameCount;
return '[' + w + 'x' + h + '] ';
};
ns.CursorCoordinatesController.prototype.onCursorMoved_ = function (event, x, y) {