MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / canFitText

Function canFitText

public/iframe/lib/js/echarts-wordcloud.js:821–841  ·  view source on GitHub ↗
(gx, gy, gw, gh, occupied)

Source from the content-addressed store, hash-verified

819
820 /* Determine if there is room available in the given dimension */
821 var canFitText = function canFitText(gx, gy, gw, gh, occupied) {
822 // Go through the occupied points,
823 // return false if the space is not available.
824 var i = occupied.length;
825 while (i--) {
826 var px = gx + occupied[i][0];
827 var py = gy + occupied[i][1];
828
829 if (px >= ngx || py >= ngy || px < 0 || py < 0) {
830 if (!settings.drawOutOfBound) {
831 return false;
832 }
833 continue;
834 }
835
836 if (!grid[px][py]) {
837 return false;
838 }
839 }
840 return true;
841 };
842
843 /* Actually draw the text on the grid */
844 var drawText = function drawText(gx, gy, info, word, weight,

Callers 1

tryToPutWordAtPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected