diff --git a/ui/data.js b/ui/data.js index f0cae5b2..76060634 100755 --- a/ui/data.js +++ b/ui/data.js @@ -144,6 +144,10 @@ var UPDATE_SORT_ENABLED = false // XXX for some reason the sync version appears to work faster... var UPDATE_SYNC = false +// if this is true image previews will be loaded synchronously by +// default... +var SYNC_IMG_LOADER = false + /********************************************************************** @@ -1097,8 +1101,23 @@ function convertDataGen1(data, cmp){ * Loaders */ +function updateImageIndicators(gid, image){ + gid = gid == null ? getImageGID() : gid + image = image == null ? getImage() : $(image) + + // marks... + if(MARKED.indexOf(gid) != -1){ + image.addClass('marked') + } else { + image.removeClass('marked') + } + + return image +} + + // helper... -function _loadImageURL(image, url){ +function _loadImagePreviewURL(image, url){ // pre-cache and load image... // NOTE: this will make images load without a blackout... var img = new Image() @@ -1112,9 +1131,6 @@ function _loadImageURL(image, url){ } -var SYNC_IMG_LOADER = true - - // Update an image element // // NOTE: care must be taken to reset ALL attributes an image can have, @@ -1158,21 +1174,21 @@ function updateImage(image, gid, size, sync){ var p_url = getBestPreview(gid, size).url // sync load... if(sync){ - _loadImageURL(image, p_url) + _loadImagePreviewURL(image, p_url) // async load... } else { // NOTE: storing the url in .data() makes the image load the - // last preview and in a case when we - // manage to call updateImage(...) on the same element - // multiple times before the previews get loaded... + // last requested preview and in a case when we manage to + // call updateImage(...) on the same element multiple times + // before the previews get loaded... // ...setting the data().loading is sync while loading an - // image is not and if several loads are done in sequence + // image is not, and if several loads are done in sequence // there is no guarantee that they will happen in the same // order as requested... image.data().loading = p_url setTimeout(function(){ - _loadImageURL(image, image.data().loading) + _loadImagePreviewURL(image, image.data().loading) }, 0) } @@ -1192,12 +1208,8 @@ function updateImage(image, gid, size, sync){ // NOTE: this only has effect on non-square image blocks... correctImageProportionsForRotation(image) - // marks... - if(MARKED.indexOf(gid) != -1){ - image.addClass('marked') - } else { - image.removeClass('marked') - } + // marks and other indicators... + updateImageIndicators(gid, image) return image } diff --git a/ui/experiments/seporate-image-and-background.html b/ui/experiments/seporate-image-and-background.html index 5ab77e23..92c2ece8 100755 --- a/ui/experiments/seporate-image-and-background.html +++ b/ui/experiments/seporate-image-and-background.html @@ -138,8 +138,69 @@ } +/*********************************************************************/ + +.mark { + display: inline-block; + position: relative; + width: 300px; + height: 300px; + margin-left: -300px; + left: 0px; + box-sizing: border-box; + vertical-align: middle; +} + +.current + .mark { + border: solid red 5px; +} + +.mark.blue, +.mark.red, +.mark.yellow { + width: 25px; + margin-left: -25px; + border: none; +} +.mark.blue:after, +.mark.red:after, +.mark.yellow:after { + display: block; + position: absolute; + content: ""; + font-size: 0pt; + border: none; + + width: 15px; + height: 15px; + + top: auto; + bottom: 10px; + left: auto; + right: 10px; + + border-radius: 50%; +} +.mark.blue:after { + background: blue; +} +.mark.red { + left: -17px; + width: 25px; +} +.mark.red:after { + background: red; +} +.mark.yellow { + left: -34px; + width: 25px; +} +.mark.yellow:after { + background: yellow; +} +
The current structure... @@ -171,5 +232,20 @@ + +