MCPcopy Create free account
hub / github.com/microsoft/SandDance / scaler

Function scaler

docs/app/js/sanddance-app.js:138761–138770  ·  view source on GitHub ↗
(width, height, padding)

Source from the content-addressed store, hash-verified

138759 };
138760}
138761function scaler(width, height, padding) {
138762 const ratio = Math.max(1, Math.sqrt(width * height / 1e6)), w = ~~((width + 2 * padding + ratio) / ratio), h = ~~((height + 2 * padding + ratio) / ratio), scale = (_)=>~~((_ + padding) / ratio);
138763 scale.invert = (_)=>_ * ratio - padding;
138764 scale.bitmap = ()=>Bitmap(w, h);
138765 scale.ratio = ratio;
138766 scale.padding = padding;
138767 scale.width = width;
138768 scale.height = height;
138769 return scale;
138770}
138771function placeAreaLabelNaive($, bitmaps, avoidBaseMark, markIndex) {
138772 const width = $.width, height = $.height; // try to place a label within an input area mark
138773 return function(d) {

Callers 1

labelLayoutFunction · 0.70

Calls 2

BitmapFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected