Skip to content

Commit

Permalink
fix(createViewer): capitalize Fixed image to match Image
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Mar 22, 2023
1 parent fe66393 commit ce11e2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions examples/compare-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
)

const container = document.querySelector('#viewport')

// Provide fixedImage and compare as createViewer options example:
// const viewer = await itkVtkViewer.createViewer(container, {
// rotate: false,
Expand All @@ -45,24 +46,24 @@
const viewer = await itkVtkViewer.createViewer(container, {
rotate: false,
})
viewer.setImage(fixedImageUrl, 'fixed') // fixed image must be first one added
viewer.setImage(fixedImageUrl, 'Fixed') // fixed image must be first one added
viewer.setImage(imageUrl, 'Image')

viewer.setCompareImages('fixed', 'Image', {
viewer.setCompareImages('Fixed', 'Image', {
method: 'checkerboard',
swapImageOrder: true,
})

setTimeout(
() =>
viewer.setCompareImages('fixed', 'Image', {
viewer.setCompareImages('Fixed', 'Image', {
method: 'disabled',
}),
2000
)
setTimeout(
() =>
viewer.setCompareImages('fixed', 'Image', {
viewer.setCompareImages('Fixed', 'Image', {
method: 'checkerboard',
pattern: [1, 2, 3],
}),
Expand All @@ -71,7 +72,7 @@

setTimeout(
() =>
viewer.setCompareImages('fixed', 'Image', {
viewer.setCompareImages('Fixed', 'Image', {
method: 'checkerboard',
pattern: [1, 2, 3],
swapImageOrder: true,
Expand Down
4 changes: 2 additions & 2 deletions src/createViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ const createViewer = async (

// must come before moving/main image
if (fixedImage) {
await publicAPI.setImage(fixedImage, 'fixed') // must await so fixedImage is the first one
await publicAPI.setImage(fixedImage, 'Fixed') // must await so fixedImage is the first one
}

if (imageMultiscale) {
Expand All @@ -1276,7 +1276,7 @@ const createViewer = async (
}

if (fixedImage && imageMultiscale) {
publicAPI.setCompareImages('fixed', imageMultiscale.name, compare)
publicAPI.setCompareImages('Fixed', imageMultiscale.name, compare)
}

if (!context.use2D) {
Expand Down

0 comments on commit ce11e2e

Please sign in to comment.