Skip to content

Commit

Permalink
Clean up Arcade
Browse files Browse the repository at this point in the history
  • Loading branch information
ekenes committed Feb 9, 2024
1 parent 6735cd2 commit 02b7f97
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions wurman/smart-mapping-update.html
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@
const sampleBinHeight = sampleBin.extent.height;

const binSize = sampleBinWidth < sampleBinHeight ? sampleBinWidth : sampleBinHeight;
const maxSize = (binSize / view.resolution);
// pixel to point conversion
const maxSize = (binSize / view.resolution) * 0.75;

return {
maxSize,
Expand Down Expand Up @@ -850,8 +851,8 @@
expression: sizeByScaleEnabled ? `
var maxSize = ${maxSize};
var referenceScale = ${view.scale};
return (maxSize * (referenceScale / $view.scale)) * 0.75;
` : `${maxSize} * 0.75`,
return (maxSize * (referenceScale / $view.scale));
` : `${maxSize}`,
returnType: "Default"
};

Expand All @@ -870,26 +871,22 @@
valueExpressionInfo: {
type: "CIMExpressionInfo",
title: "Size in pixels of inner ring at maxScale",
// outerSize is the pixel size at the largest scale
// The innerSize is determined by multiplying
// the outerSize by the forest ratio
expression: `
${fields}
var value = ${value};
var referenceScale = ${view.scale};
var maxSize = ${maxSize};
var minSize = ${minSize};
var referenceScaleRatio = ${sizeByScaleEnabled ? `(referenceScale / $view.scale)` : 1};
var maxSize = ${maxSize} * referenceScaleRatio;
var minSize = ${minSize} * referenceScaleRatio;
var minDataValue = ${minDataValue};
var maxDataValue = ${maxDataValue};
var ratio = ( value - minDataValue) / (maxDataValue - minDataValue );
var innerRatio = Constrain(ratio, 0, 1);
var ratio = Constrain(( value - minDataValue ) / ( maxDataValue - minDataValue ), 0, 1);
var referenceScaleRatio = ${sizeByScaleEnabled ? `(referenceScale / $view.scale)` : 1};
var outerSize = maxSize * referenceScaleRatio;
var innerSize = Constrain((outerSize * innerRatio) + minSize, minSize, outerSize);
// pixel to point conversion
return innerSize * 0.75;
var innerDotSize = Constrain(maxSize * ratio, minSize, maxSize);
return innerDotSize;
`,
returnType: "Default"
}
Expand Down

0 comments on commit 02b7f97

Please sign in to comment.