-
25 May 2012 12:13 AM #41
Ok guys, this is my improvement to prevent switching between images when active image is zoomed in.
Thanks umbro77 for giving me some hints.
In the imageviewer:
Add
Add two lines in onDoubleTap function:Code:config: { ..., isZoomed: false ... }
In your carousel, you should have a onDragStart function (line 343 for me), just add:Code:onDoubleTap: function(ev, t) { var me = this, scroller = me.getScrollable().getScroller(), scrollPosition = scroller.position, element = me.element; if(!me.getDoubleTapScale()) return false; // set scale and translation if(me.scale > me.baseScale) { // ZOOM OUT to base view me.setIsZoomed(false); me.scale = me.baseScale; me.setTranslation(me.translateBaseX, me.translateBaseY); // reset origin and update transform with new translation me.applyTransform(); // adjust scroll container me.adjustScroller(); // force repaint to solve occasional iOS rendering delay Ext.repaint(); } else { // ZOOM IN toward tap position me.setIsZoomed(true); var oldScale = me.scale, newScale = me.baseScale * me.getZoomRatio(), originViewportX = ev ? (ev.pageX - element.getX()) : 0, originViewportY = ev ? (ev.pageY - element.getY()) : 0, originScaledImgX = originViewportX + scrollPosition.x - me.translateX, originScaledImgY = originViewportY + scrollPosition.y - me.translateY, originReScaledImgX = originScaledImgX * (newScale / oldScale), originReScaledImgY = originScaledImgY * (newScale / oldScale); me.scale = newScale; //smoothes the transition setTimeout(function(){ me.setTranslation(originViewportX - originReScaledImgX, originViewportY - originReScaledImgY); // reset origin and update transform with new translation me.applyTransform(); // adjust scroll container me.adjustScroller(); // force repaint to solve occasional iOS rendering delay Ext.repaint(); },50) } },
Hope this helps!!!Code:onDragStart: function(e) { // if current image is zoomed in, stop switching if (this.getActiveItem().getIsZoomed()) { e.stopPropagation(); return; } var direction = this.getDirection(), absDeltaX = e.absDeltaX, absDeltaY = e.absDeltaY, directionLock = this.getDirectionLock(); ....
-
31 May 2012 7:04 AM #42
Could someone please put all those "I optimized this" and "I fixed that" code togehter in one slideshow class? And maybe, host that class somewhere togehter with an example?
thx Sunny
-
5 Jun 2012 2:45 PM #43
If you put the carousel inside a nestedList as a detailCard, it works only the first time.
To fix, i changed the ImageCarousel activeitemchange and the activate listeners.
Note the "container.getScrollable()" in "activeitemchange" and "component.setActiveItem(0)" in "activate"
Code:listeners : { activeitemchange: function(container, value, oldValue, eOpts){ if(container.getScrollable() && oldValue){ oldValue.resetZoom(); this.getActiveItem().resize(); } }, resize: function(component, eOpts){ this.getActiveItem().resize(); }, activate: function(component){ component.setActiveItem(0); } }
-
5 Jun 2012 10:25 PM #44
Nice work.
On my ipad, at the end of a pinch/zoom gesture, the image disappears and reappears very fast.
Is there a way to avoid that?
Thanks
-
20 Jun 2012 11:01 PM #45
Amazing
Amazing
You did amazing images component.
Is there any possibility let the HTML contents can be zoom in/out like images?
-
17 Aug 2012 5:17 AM #46
Bugfix as a suggestion
Bugfix as a suggestion
Hey,
ImageViewer#onImageLoad if this.viewportWidth > this.baseScale * this.imgWidth, translateX and translateBaseX will be negativ and the image will be cut off. #setTransition use the < 0 evaluation and works correct so I changed the lines:
to:Code:// set initial translation to center this.translateX = this.translateBaseX = (this.viewportWidth - this.baseScale * this.imgWidth) / 2; this.translateY = this.translateBaseY = (this.viewportHeight - this.baseScale * this.imgHeight) / 2;
That works for me :-)Code:// calc initial translation var tmpTranslateX = (this.viewportWidth - this.baseScale * this.imgWidth) / 2; var tmpTranslateY = (this.viewportHeight - this.baseScale * this.imgHeight) / 2; // set initial translation to center this.setTranslation(tmpTranslateX, tmpTranslateY); this.translateBaseX = this.translateX; this.translateBaseY = this.translateY;
-
20 Aug 2012 12:28 AM #47
Hi contech
thanks for your suggestion!
I can't find any case where the translate variables are getting < 0 on load?
In my code it looks like that this case is not possible, because of:
Maybe you doesn't use the latest version of this component? You don't use the perfomance optimisation with coping the scope into the me variable...Code:me.baseScale = Math.min(me.viewportWidth/me.imgWidth, me.viewportHeight/me.imgHeight);
-
23 Aug 2012 4:51 AM #48
Don't read this the wrong way, I use this component (with my own modifications) but keeping up with all changes here is hard.
You refer to the latest version, so what would that be?
This thread continually posts some version and separate fixes all over the place.
If someone would be so nice as to make a github repository or such for this component, then development could be more streamlined imo.
-
24 Aug 2012 2:10 AM #49
I think many people are asking the same thing, Jeroen. The thread has become so complicated and diverse that the majority have little or no chance of geting this component going. You suggest putting something on GitHub - great idea - and as you seem to have a working version, any chance you can get the ball rolling and we could start with that...?
allister
-
24 Aug 2012 2:17 AM #50
My version already is on Github.
It is part of my comic reader web app.
You can find it here https://github.com/jeroenwalter/Bada...ImageViewer.js
It is however modified for my own use so it fits better in my project. It is also based on a version from a few months back.
Maybe I will create a new repository for it, because I haven't changed that much and I think the changes I made may be useful to others.
However, I'm quite pleased with how it is working right now, so I don't plan to work on it until I need something fixed or have to add a new feature.
Right now my focus is on making the web app as a whole better. I'm in the process of rewriting the whole comic reader so it will be a plugin for ComicRack.
For details you may take a look at http://www.badaap.nl/wordpress/badaa...ck-web-viewer/


Reply With Quote