Skip to content

Commit

Permalink
print data in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mhkeller committed Mar 8, 2024
1 parent 10d7fd5 commit e96bfd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib/LayerCake.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@
$: if ($box_d && debug === true && (ssr === true || typeof window !== 'undefined')) {
// Call this as a debounce so that it doesn't get called multiple times as these vars get filled in
printDebug_debounced({
data: $_data,
boundingBox: $box_d,
activeGetters: $activeGetters_d,
x: config.x,
Expand Down
6 changes: 4 additions & 2 deletions src/lib/helpers/printDebug.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function contrast({ r, g, b }) {
export default function printDebug(obj) {
console.log('/********* LayerCake Debug ************/');
console.log('Bounding box:');
printObject(obj.boundingBox)
printObject(obj.boundingBox);
console.log('Data:');
console.log(indent, obj.data);
console.log('Scales:\n');
Object.keys(obj.activeGetters).forEach(g => {
printScale(g, obj[`${g}Scale`], obj[g]);
Expand All @@ -42,7 +44,7 @@ export default function printDebug(obj) {
function printObject(obj) {
Object.entries(obj).forEach(([key, value]) => {
console.log(`${indent}${key}:`, value);
})
});
}

function printScale(s, scale, acc) {
Expand Down

0 comments on commit e96bfd3

Please sign in to comment.