MCPcopy Index your code
hub / github.com/TruthHun/BookStack / getRotatedSizes

Function getRotatedSizes

static/cropper/2.3.4/cropper.js:197–220  ·  view source on GitHub ↗
(data, isReversed)

Source from the content-addressed store, hash-verified

195 }
196
197 function getRotatedSizes(data, isReversed) {
198 var deg = abs(data.degree) % 180;
199 var arc = (deg > 90 ? (180 - deg) : deg) * Math.PI / 180;
200 var sinArc = sin(arc);
201 var cosArc = cos(arc);
202 var width = data.width;
203 var height = data.height;
204 var aspectRatio = data.aspectRatio;
205 var newWidth;
206 var newHeight;
207
208 if (!isReversed) {
209 newWidth = width * cosArc + height * sinArc;
210 newHeight = width * sinArc + height * cosArc;
211 } else {
212 newWidth = width / (cosArc + sinArc / aspectRatio);
213 newHeight = newWidth / aspectRatio;
214 }
215
216 return {
217 width: newWidth,
218 height: newHeight
219 };
220 }
221
222 function getSourceCanvas(image, data) {
223 var canvas = $('<canvas>')[0];

Callers 2

getSourceCanvasFunction · 0.85
cropper.jsFile · 0.85

Calls 1

cosFunction · 0.85

Tested by

no test coverage detected