Skip to content

Commit

Permalink
Merge pull request #173 from mhkeller/data-debug
Browse files Browse the repository at this point in the history
Also print `data` in debug
  • Loading branch information
mhkeller authored Mar 8, 2024
2 parents 10d7fd5 + 1891ce1 commit 8ba3f44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
===

# 8.1.0

> 2024-04-07
Also print the `data` object when `debug` is set.

* [PR#149](https://github.com/mhkeller/layercake/pull/149)

# 8.0.2

> 2023-10-14
Expand Down
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 8ba3f44

Please sign in to comment.