MCPcopy
hub / github.com/ecomfe/echarts-wordcloud / adjustRectAspect

Function adjustRectAspect

src/wordCloud.js:201–213  ·  view source on GitHub ↗
(gridRect, aspect)

Source from the content-addressed store, hash-verified

199});
200
201function adjustRectAspect(gridRect, aspect) {
202 // var outerWidth = gridRect.width + gridRect.x * 2;
203 // var outerHeight = gridRect.height + gridRect.y * 2;
204 var width = gridRect.width;
205 var height = gridRect.height;
206 if (width > height * aspect) {
207 gridRect.x += (width - height * aspect) / 2;
208 gridRect.width = height * aspect;
209 } else {
210 gridRect.y += (height - width / aspect) / 2;
211 gridRect.height = width / aspect;
212 }
213}

Callers 1

wordCloud.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected