diff --git a/dev/generic-test-harness.html b/dev/generic-test-harness.html index b709181a5..829270af7 100644 --- a/dev/generic-test-harness.html +++ b/dev/generic-test-harness.html @@ -259,7 +259,7 @@ ] }; - igv.createBrowser(document.getElementById("igv-container"), config_offscreen_scroll).then(browser => { + igv.createBrowser(document.getElementById("igv-container"), config).then(browser => { console.log(`browser ${ browser.guid } is good to go`) }); diff --git a/dev/ui/example.html b/dev/ui/example.html index 88c824557..c1eab32e6 100644 --- a/dev/ui/example.html +++ b/dev/ui/example.html @@ -23,14 +23,12 @@

UI classes demo

diff --git a/js/ui/components/colorPicker.js b/js/ui/components/colorPicker.js deleted file mode 100644 index 5c0b4ef1f..000000000 --- a/js/ui/components/colorPicker.js +++ /dev/null @@ -1,58 +0,0 @@ -import {appleCrayonPalette} from '../utils/colorPalettes.js' -import * as DOMUtils from "../utils/dom-utils.js" -import GenericContainer from "../genericContainer.js" - - -class ColorPicker extends GenericContainer { - - constructor({parent, top, left, width, height, defaultColors, colorHandler}) { - - super({ parent, top, left, width, height, border: '1px solid gray'}) - - createColorSwatchSelector(this.container, colorHandler, defaultColors); - } - -} - -const createColorSwatchSelector = (container, colorHandler, defaultColors) => { - - const hexColorStrings = Object.values(appleCrayonPalette); - - for (let hexColorString of hexColorStrings) { - const swatch = DOMUtils.div({ class: 'igv-ui-color-swatch' }); - container.appendChild(swatch); - decorateSwatch(swatch, hexColorString, colorHandler) - } - - if (defaultColors) { - for (let hexColorString of defaultColors) { - const swatch = DOMUtils.div({ class: 'igv-ui-color-swatch' }); - container.appendChild(swatch); - decorateSwatch(swatch, hexColorString, colorHandler) - } - } - -} - -const decorateSwatch = (swatch, hexColorString, colorHandler) => { - - swatch.style.backgroundColor = hexColorString; - - swatch.addEventListener('mouseenter', e => swatch.style.borderColor = hexColorString) - - swatch.addEventListener('mouseleave', e => swatch.style.borderColor = 'white') - - swatch.addEventListener('click', event => { - event.stopPropagation(); - colorHandler(hexColorString); - }) - - swatch.addEventListener('touchend', event => { - event.stopPropagation(); - colorHandler(hexColorString); - }) - -} - -export { createColorSwatchSelector } -export default ColorPicker diff --git a/js/ui/components/genericColorPicker.js b/js/ui/components/genericColorPicker.js index 73dc2e5fe..ccd68d378 100644 --- a/js/ui/components/genericColorPicker.js +++ b/js/ui/components/genericColorPicker.js @@ -1,6 +1,6 @@ import * as DOMUtils from "../utils/dom-utils.js" import Picker from "../../../node_modules/vanilla-picker/dist/vanilla-picker.csp.mjs" -import GenericContainer from '../genericContainer.js' +import GenericContainer from './genericContainer.js' import {genericColorPickerPalette} from "../../util/colorPalletes.js" class GenericColorPicker extends GenericContainer { diff --git a/js/ui/genericContainer.js b/js/ui/components/genericContainer.js similarity index 89% rename from js/ui/genericContainer.js rename to js/ui/components/genericContainer.js index fb0c0167f..42d4052a9 100644 --- a/js/ui/genericContainer.js +++ b/js/ui/components/genericContainer.js @@ -1,6 +1,6 @@ -import * as UIUtils from "./utils/ui-utils.js" -import * as DOMUtils from "./utils/dom-utils.js" -import makeDraggable from "./utils/draggable.js" +import * as UIUtils from "../utils/ui-utils.js" +import * as DOMUtils from "../utils/dom-utils.js" +import makeDraggable from "../utils/draggable.js" class GenericContainer { diff --git a/js/ui/popover.js b/js/ui/popover.js index 50b291708..f38cea7af 100644 --- a/js/ui/popover.js +++ b/js/ui/popover.js @@ -1,7 +1,6 @@ import * as Icon from './utils/icons.js' import * as DOMUtils from "./utils/dom-utils.js" import makeDraggable from "./utils/draggable.js" -import ColorPicker from "./components/colorPicker.js" import {createIcon} from "./utils/icons.js" class Popover {