started work on flipping...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-04 16:32:33 +04:00
parent 6dcc86540b
commit 09675e12b4
7 changed files with 734 additions and 695 deletions

View File

@ -877,27 +877,79 @@ function rotateImage(direction, image){
}) })
$('.viewer').trigger('rotating' + direction.capitalize(), [image]) $('.viewer').trigger('rotating' + direction.capitalize(), [image])
return image
} }
function rotateLeft(image){ function rotateLeft(image){
rotateImage('left', image) return rotateImage('left', image)
} }
function rotateRight(image){ function rotateRight(image){
rotateImage('right', image) return rotateImage('right', image)
} }
/******************************************************** Flipping ***/ /******************************************************** Flipping ***/
function flipVertical(image){ function getImageFlipState(image){
// XXX image = image == null ? getImage() : $(image)
var state = image.attr('flipped')
if(state == null){
return []
}
state = state.split(',').map(function(e){ return e.trim() })
return state
}
function setImageFlipState(image, state){
image = image == null ? getImage() : $(image)
if(state.length == 0){
image.removeAttr('flipped')
} else if(state != null){
image.attr('flipped', state.join(', '))
}
return image
}
// XXX not yet implemented...
// ...mostly because it will conflict with turning and require a
// very tightly woven with rotation code, both JS and CSS...
// i.e. requiring two sets of rotation styles, one for flipped
// and another for horizontally flipped image.
// ...at least flipping will not affect the square/viewer aspect
// ratio of images.
function flipImage(direction, image){
image = image == null ? getImage() : $(image)
image.each(function(i, e){
var img = $(this)
var state = getImageFlipState(img)
var i = state.indexOf(direction)
if(i >= 0){
state.splice(i, 1)
} else {
state.push(direction)
}
setImageFlipState(image, state)
})
$('.viewer').trigger('flipping' + direction.capitalize(), [image])
return image
} }
function flipVertical(image){
return flipImage('vertical')
}
function flipHorizontal(image){ function flipHorizontal(image){
// XXX return flipImage('horizontal')
} }

View File

@ -1425,6 +1425,8 @@ function updateRibbonsFromFavDirs(){
* Actions... * Actions...
*/ */
/******************************************************** Extension **/
// Open image in an external editor/viewer // Open image in an external editor/viewer
// //
// NOTE: this will open the default editor/viewer. // NOTE: this will open the default editor/viewer.
@ -1438,6 +1440,9 @@ function openImage(){
} }
/********************************************************** Sorting **/
function reverseImageOrder(){ function reverseImageOrder(){
DATA.order.reverse() DATA.order.reverse()
updateRibbonOrder() updateRibbonOrder()
@ -1466,6 +1471,9 @@ function sortImagesByName(reverse){
} }
/*************************************************** Manual sorting **/
// Ordering images... // Ordering images...
// NOTE: this a bit more complicated than simply shifting an image // NOTE: this a bit more complicated than simply shifting an image
// left/right the DATA.order, we have to put it before or after // left/right the DATA.order, we have to put it before or after

View File

@ -4,6 +4,8 @@
<link rel="stylesheet" href="layout.css"> <link rel="stylesheet" href="layout.css">
<!-- use only for devel... -->
<link rel="stylesheet/less" href="layout.less">
<style> <style>
@ -12,6 +14,38 @@
</style> </style>
<script>
less = {
// or "production"
env: "development",
// load imports async
async: false,
// load imports async when in a page under
// a file protocol
fileAsync: false,
// when in watch mode, time in ms between polls
//poll: 1000,
// user functions, keyed by name
//functions: {},
// or "mediaQuery" or "all"
//dumpLineNumbers: "comments",
// whether to adjust url's to be relative
// if false, url's are already relative to the
// entry less file
//relativeUrls: false,
// a path to add on to the start of every url
//resource
//rootpath: ":/a.com/"
}
</script>
<script src="ext-lib/less.js"></script>
<script src="ext-lib/jquery.js"></script> <script src="ext-lib/jquery.js"></script>
<script src="lib/jli.js"></script> <script src="lib/jli.js"></script>

View File

@ -1,46 +1,40 @@
/********************************************************************** /**********************************************************************
* *
**********************************************************************/ **********************************************************************/
body { body {
font-family: sans-serif; font-family: sans-serif;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
/********************************************************** Viewer ***/ /********************************************************** Viewer ***/
.viewer { .viewer {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
/*border: solid blue 1px;*/ /*border: solid blue 1px;*/
box-sizing: border-box;
box-sizing: border-box;
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
-o-user-select: none; -o-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
/****************************************************** Ribbon set ***/ /****************************************************** Ribbon set ***/
.ribbon-set { .ribbon-set {
position: absolute; position: absolute;
display: block; display: block;
/* NOTE: this needs for scaling/zooming to behave correctly and not /* NOTE: this needs for scaling/zooming to behave correctly and not
shift the element, when its dimensions change... shift the element, when its dimensions change...
...this is because .ribbon-set will both be used for scaling ...this is because .ribbon-set will both be used for scaling
and aligning... */ and aligning... */
transform-origin: top left; transform-origin: top left;
-ms-transform-origin: top left; -ms-transform-origin: top left;
-webkit-transform-origin: top left; /* Safari and Chrome */ -webkit-transform-origin: top left;
/* Safari and Chrome */
} }
.ribbon-set:empty:after { .ribbon-set:empty:after {
display: block; display: block;
@ -51,9 +45,6 @@ body {
content: "Empty"; content: "Empty";
text-align: center; text-align: center;
} }
/********************************************************** Ribbon ***/ /********************************************************** Ribbon ***/
.ribbon { .ribbon {
position: relative; position: relative;
@ -63,7 +54,6 @@ body {
overflow: visible; overflow: visible;
white-space: nowrap; white-space: nowrap;
font-size: 0; font-size: 0;
margin-top: 20px; margin-top: 20px;
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -76,9 +66,6 @@ body {
.ribbon:last-child { .ribbon:last-child {
margin-bottom: 0px; margin-bottom: 0px;
} }
/*********************************************************** Image ***/ /*********************************************************** Image ***/
.image { .image {
position: relative; position: relative;
@ -89,26 +76,22 @@ body {
height: 300px; height: 300px;
font-size: 12pt; font-size: 12pt;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
color: white; color: white;
text-shadow: black 0.1em 0.1em 0.4em, black 0.1em 0.1em; text-shadow: black 0.1em 0.1em 0.4em, black 0.1em 0.1em;
background: no-repeat 50% #000000;
background: no-repeat 50% black;
background-size: contain; background-size: contain;
/* XXX do we need this? */ /* XXX do we need this? */
border: solid black 5px; border: solid black 5px;
} }
.current.image { .current.image {
background: no-repeat 50% black; background: no-repeat 50% #000000;
background-size: contain; background-size: contain;
/* XXX remove this... */ /* XXX remove this... */
border: solid red 5px; border: solid red 5px;
} }
/* image turning... */ /* image turning... */
/* NOTE: need to account for proportions after turning... */ /* NOTE: need to account for proportions after turning... */
.image[orientation="90"] { .image[orientation="90"] {
@ -132,8 +115,33 @@ body {
-ms-transform: rotate(270deg); -ms-transform: rotate(270deg);
transform: rotate(270deg); transform: rotate(270deg);
} }
/* Flipped vertically only... */
/* NOTE: wee need to do all possible combinations here as we can't
combine different parts of a transform attr from different
classes */
.image[flipped*="vertical"] {
-moz-transform: scaleY(-1);
-o-transform: scaleY(-1);
-webkit-transform: scaleY(-1);
-ms-transform: scaleY(-1);
transform: scaleY(-1);
}
/* Flipped horizontally only... */
.image[flipped*="horizontal"] {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
-ms-transform: scaleX(-1);
transform: scaleX(-1);
}
/* Flipped vertically only... */
.image[flipped*="vertical"][flipped*="horizontal"] {
-moz-transform: scaleX(-1) scaleY(-1);
-o-transform: scaleX(-1) scaleY(-1);
-webkit-transform: scaleX(-1) scaleY(-1);
-ms-transform: scaleX(-1) scaleY(-1);
transform: scaleX(-1) scaleY(-1);
}
/* default backgrounds */ /* default backgrounds */
/* XXX not sure if we need these... */ /* XXX not sure if we need these... */
/* /*
@ -150,9 +158,6 @@ body {
background-image: url(images/loading-270deg.gif); background-image: url(images/loading-270deg.gif);
} }
*/ */
/***************************************************** Image marks ***/ /***************************************************** Image marks ***/
.marks-visible.viewer .marked.image:after { .marks-visible.viewer .marked.image:after {
display: block; display: block;
@ -160,13 +165,10 @@ body {
content: ""; content: "";
font-size: 0pt; font-size: 0pt;
border: none; border: none;
width: 15px; width: 15px;
height: 15px; height: 15px;
bottom: 5px; bottom: 5px;
right: 5px; right: 5px;
border-radius: 50%; border-radius: 50%;
background: blue; background: blue;
} }
@ -182,12 +184,10 @@ body {
bottom: 5px; bottom: 5px;
left: 5px; left: 5px;
} }
/* XXX make the marks position relative to viewer or gidden compleatly */ /* XXX make the marks position relative to viewer or gidden compleatly */
.marks-visible.single-image-mode.viewer .marked.image:after { .marks-visible.single-image-mode.viewer .marked.image:after {
display: none; display: none;
} }
/* corner mark... (a-la bookmarks in PortableMag) */ /* corner mark... (a-la bookmarks in PortableMag) */
/* /*
.marks-visible.viewer .marked.image:after { .marks-visible.viewer .marked.image:after {
@ -224,8 +224,6 @@ body {
right: -15px; right: -15px;
} }
*/ */
/*.marks-visible.viewer:not(.single-image-mode):after {*/ /*.marks-visible.viewer:not(.single-image-mode):after {*/
/* /*
.marks-visible.viewer:after { .marks-visible.viewer:after {
@ -261,18 +259,13 @@ body {
background: blue; background: blue;
} }
*/ */
/* XXX should we use opacity??? */ /* XXX should we use opacity??? */
.marked-only-view.viewer:not(.marks-visible) .image:not(.marked) { .marked-only-view.viewer:not(.marks-visible) .image:not(.marked) {
opacity: 0.3; opacity: 0.3;
} }
/****************************************************** Image info ***/ /****************************************************** Image info ***/
.image .inline-image-info { .image .inline-image-info {
display: none; display: none;
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
@ -300,11 +293,9 @@ body {
.image[orientation="90"] .inline-image-info { .image[orientation="90"] .inline-image-info {
top: auto; top: auto;
left: 100%; left: 100%;
-ms-transform-origin: bottom left; -ms-transform-origin: bottom left;
-webkit-transform-origin: bottom left; -webkit-transform-origin: bottom left;
transform-origin: bottom left; transform-origin: bottom left;
-webkit-transform: rotate(-90deg); -webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg); -moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg); -o-transform: rotate(-90deg);
@ -314,7 +305,6 @@ body {
.image[orientation="180"] .inline-image-info { .image[orientation="180"] .inline-image-info {
top: 0px; top: 0px;
bottom: auto; bottom: auto;
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg); -moz-transform: rotate(180deg);
-o-transform: rotate(180deg); -o-transform: rotate(180deg);
@ -325,22 +315,18 @@ body {
top: auto; top: auto;
left: auto; left: auto;
right: 100%; right: 100%;
-ms-transform-origin: bottom right; -ms-transform-origin: bottom right;
-webkit-transform-origin: bottom right; -webkit-transform-origin: bottom right;
transform-origin: bottom right; transform-origin: bottom right;
-webkit-transform: rotate(90deg); -webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg); -moz-transform: rotate(90deg);
-o-transform: rotate(90deg); -o-transform: rotate(90deg);
-ms-transform: rotate(90deg); -ms-transform: rotate(90deg);
transform: rotate(90deg); transform: rotate(90deg);
} }
.overlay-info { .overlay-info {
display: none; display: none;
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
left: 0px; left: 0px;
width: 100%; width: 100%;
@ -348,10 +334,8 @@ body {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
box-sizing: border-box; box-sizing: border-box;
background: black; background: black;
color: white; color: white;
opacity: 0.6; opacity: 0.6;
} }
.overlay-info:hover { .overlay-info:hover {
@ -374,18 +358,12 @@ body {
color: white; color: white;
background: red; background: red;
} }
/*************************************************** Global status ***/ /*************************************************** Global status ***/
.global-status { .global-status {
display: block; display: block;
opacity: 1; opacity: 1;
z-index: 1000; z-index: 1000;
} }
/****************************************************** Indicators ***/ /****************************************************** Indicators ***/
.up-indicator, .up-indicator,
.down-indicator, .down-indicator,
@ -399,9 +377,7 @@ body {
height: 50px; height: 50px;
width: 100px; width: 100px;
margin-left: -50px; margin-left: -50px;
overflow: hidden; overflow: hidden;
cursor: hand; cursor: hand;
} }
.up-indicator:after, .up-indicator:after,
@ -411,12 +387,9 @@ body {
content: ""; content: "";
width: 50px; width: 50px;
height: 50px; height: 50px;
bottom: -25px; bottom: -25px;
left: 25px; left: 25px;
background: yellow; background: yellow;
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg); -moz-transform: rotate(45deg);
-o-transform: rotate(45deg); -o-transform: rotate(45deg);
@ -437,7 +410,6 @@ body {
width: 10px; width: 10px;
height: 100%; height: 100%;
margin: 0px; margin: 0px;
background: yellow; background: yellow;
} }
.end-indicator { .end-indicator {
@ -451,8 +423,6 @@ body {
.end-indicator { .end-indicator {
display: none; display: none;
} }
/* these are generic containers for indicators */ /* these are generic containers for indicators */
.global-mode-indicators { .global-mode-indicators {
position: absolute; position: absolute;
@ -460,7 +430,6 @@ body {
right: 15px; right: 15px;
height: 20px; height: 20px;
width: auto; width: auto;
font-size: small; font-size: small;
} }
.global-mode-indicators > * { .global-mode-indicators > * {
@ -485,7 +454,6 @@ body {
.single-image-mode.viewer .global-mode-indicators:hover { .single-image-mode.viewer .global-mode-indicators:hover {
opacity: 1; opacity: 1;
} }
/* context indicators */ /* context indicators */
.context-mode-indicators { .context-mode-indicators {
position: absolute; position: absolute;
@ -493,7 +461,6 @@ body {
bottom: 15px; bottom: 15px;
height: 20px; height: 20px;
width: auto; width: auto;
font-size: small; font-size: small;
} }
.context-mode-indicators > * { .context-mode-indicators > * {
@ -505,8 +472,6 @@ body {
height: 10px; height: 10px;
border-radius: 50%; border-radius: 50%;
} }
/* actual indicators */ /* actual indicators */
/* marks... */ /* marks... */
.global-mode-indicators .marked-only-visible, .global-mode-indicators .marked-only-visible,
@ -552,27 +517,24 @@ body {
.single-image-mode.marks-visible.viewer .context-mode-indicators .current-image-marked.shown { .single-image-mode.marks-visible.viewer .context-mode-indicators .current-image-marked.shown {
display: inline-block; display: inline-block;
} }
/********************************************** Mode: single image ***/ /********************************************** Mode: single image ***/
.single-image-mode.viewer .image { .single-image-mode.viewer .image {
background-color: transparent; background-color: transparent;
/* NOTE: need to keep a distance from screen borders... */ /* NOTE: need to keep a distance from screen borders... */
border: solid transparent 2px; border: solid transparent 2px;
} }
.single-image-mode.viewer .image:not(.current) { .single-image-mode.viewer .image:not(.current) {
/* XXX for some reason this breaks the alignment on large magnifications... /* XXX for some reason this breaks the alignment on large magnifications...
display: none; display: none;
*/ */
/* XXX this makes images pass through the :visible filter... /* XXX this makes images pass through the :visible filter...
opacity: 0; opacity: 0;
*/ */
visibility: hidden; visibility: hidden;
} }
/********************************************************** Themes ***/ /********************************************************** Themes ***/
/* XXX this is by no means final... */ /* XXX this is by no means final... */
.viewer, .viewer,
@ -580,19 +542,14 @@ body {
.light.viewer .overlay-block .background { .light.viewer .overlay-block .background {
background: white; background: white;
} }
.gray.viewer, .gray.viewer,
.gray.viewer .overlay-block .background { .gray.viewer .overlay-block .background {
background: #333; background: #333;
} }
.dark.viewer, .dark.viewer,
.dark.viewer .overlay-block .background { .dark.viewer .overlay-block .background {
background: #0a0a0a; background: #0a0a0a;
} }
/********************************************************* Overlay ***/ /********************************************************* Overlay ***/
.overlay-block { .overlay-block {
display: none; display: none;
@ -605,8 +562,6 @@ body {
.viewer.overlay .overlay-block { .viewer.overlay .overlay-block {
display: block; display: block;
} }
.overlay-block .content {
}
.overlay-block .background { .overlay-block .background {
position: absolute: position: absolute:
top: 0px; top: 0px;
@ -615,15 +570,11 @@ body {
width: 100%; width: 100%;
opacity: 0.7; opacity: 0.7;
} }
/************************************************************ Help ***/ /************************************************************ Help ***/
/* this is for sliding stuff */ /* this is for sliding stuff */
.viewer.drawer-mode { .viewer.drawer-mode {
box-shadow: 0px 0px 50px 0px silver; box-shadow: 0px 0px 50px 0px silver;
} }
/* help */ /* help */
.keyboard-help { .keyboard-help {
width: 80%; width: 80%;
@ -657,9 +608,6 @@ body {
padding-right: 0px; padding-right: 0px;
padding-left: 0px; padding-left: 0px;
} }
/********************************************************* utility ***/ /********************************************************* utility ***/
.expanding-text .hidden { .expanding-text .hidden {
display: none; display: none;
@ -670,8 +618,5 @@ body {
.expanding-text:hover .hidden { .expanding-text:hover .hidden {
display: inline; display: inline;
} }
/**********************************************************************
* vim:set spell ft=css : */
/*********************************************************************/

View File

@ -122,18 +122,10 @@ body {
.rotate(90deg); .rotate(90deg);
} }
.image[orientation="180"] { .image[orientation="180"] {
-webkit-transform: rotate(180deg); .rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
} }
.image[orientation="270"] { .image[orientation="270"] {
-webkit-transform: rotate(270deg); .rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
} }

View File

@ -16,7 +16,7 @@ function setupIndicators(){
.click(function(){ toggleMarkesView() }) .click(function(){ toggleMarkesView() })
showGlobalIndicator( showGlobalIndicator(
'marked-only-visible', 'marked-only-visible',
'Marked only images visible (alt-F2)') 'Marked only images visible (shift-F2)')
.css('cursor', 'hand') .css('cursor', 'hand')
.click(function(){ toggleMarkedOnlyView() }) .click(function(){ toggleMarkedOnlyView() })

View File

@ -175,9 +175,15 @@ function updateStatus(message){
// Same as updateInfo(...) but will aslo show and animate-close the message // Same as updateInfo(...) but will aslo show and animate-close the message
//
// XXX the next call will not reset the animation of the previous, rather
// it will pause it and rezume...
// ...not sure if this is correct.
function showStatus(message){ function showStatus(message){
return updateStatus.apply(null, arguments) return updateStatus.apply(null, arguments)
.stop() //.stop()
.stop(true, false)
//.finish()
.show() .show()
.delay(500) .delay(500)
.fadeOut(800) .fadeOut(800)
@ -193,7 +199,9 @@ function showErrorStatus(message){
message.splice(0, 0, 'Error:') message.splice(0, 0, 'Error:')
return updateStatus.apply(null, message) return updateStatus.apply(null, message)
.one('click', function(){ $(this).fadeOut() }) .one('click', function(){ $(this).fadeOut() })
.stop() //.stop()
.stop(true, false)
//.finish()
.show() .show()
} }