WIP no crop functionality
This commit is contained in:
@@ -58,7 +58,7 @@ var DragHandle = function (handler) {
|
||||
};
|
||||
|
||||
this.init = function () {
|
||||
var viewportData = this.getCanvas().getViewport().getCropData();
|
||||
var viewportData = this.getCanvas().getViewport().getData();
|
||||
var tracks = handler.getTracks();
|
||||
|
||||
if (this.__handles) {
|
||||
|
||||
@@ -8,7 +8,7 @@ function GoreHandler(viewport) {
|
||||
* @return {fabric.Line}
|
||||
*/
|
||||
function getLine(left) {
|
||||
return new fabric.Line([0, 0, 0, viewport.getCropData().height], {
|
||||
return new fabric.Line([0, 0, 0, viewport.getData().height], {
|
||||
evented: false,
|
||||
strokeDashArray: [5, 5],
|
||||
stroke: '#000',
|
||||
@@ -43,7 +43,7 @@ function GoreHandler(viewport) {
|
||||
}
|
||||
|
||||
var bounds = viewport.getBounds();
|
||||
var step = viewport.getCropData().ppmm * 450;
|
||||
var step = viewport.getData().ppmm * 450;
|
||||
var count = Math.ceil(bounds.width / step);
|
||||
|
||||
for (var i = 1; i < count; i++) {
|
||||
|
||||
@@ -16,10 +16,10 @@ function RulerHandler(viewport) {
|
||||
var bounds = viewport.getBounds();
|
||||
var pos = util.assertBetween(this[axis], bounds.min[axis], bounds.max[axis]);
|
||||
this.marker[axis] = this[axis] = pos;
|
||||
var dim = (this[axis] - bounds[axis]) / (viewport.getCropData().ppmm * 10);
|
||||
var dim = (this[axis] - bounds[axis]) / (viewport.getData().ppmm * 10);
|
||||
|
||||
if (axis === 'top') {
|
||||
dim = viewport.getCropData().dim.height - dim;
|
||||
dim = viewport.getData().dim.height - dim;
|
||||
}
|
||||
|
||||
this.setText(Math.round(dim * 100) / 100 + ' cm');
|
||||
|
||||
@@ -124,7 +124,7 @@ function Viewport(canvas) {
|
||||
canvas.getButtonMenu().bringToFront();
|
||||
};
|
||||
|
||||
this.getCropData = function () {
|
||||
this.getData = function () {
|
||||
return _data;
|
||||
};
|
||||
|
||||
|
||||
@@ -17,9 +17,14 @@ function calcCrop(obj, width, height) {
|
||||
var returnValue = {
|
||||
image: obj,
|
||||
axis: objRatio > cropRatio ? 'x' : 'y',
|
||||
dim: { width: width, height: height },
|
||||
dim: {
|
||||
width: Number(width),
|
||||
height: Number(height)
|
||||
},
|
||||
width: obj.width,
|
||||
height: obj.height
|
||||
height: obj.height,
|
||||
objectRatio: objRatio,
|
||||
cropRatio: cropRatio
|
||||
};
|
||||
|
||||
if (objRatio > cropRatio) {
|
||||
|
||||
Reference in New Issue
Block a user