Coder Social home page Coder Social logo

sunbox / st2_imageviewer Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 15.0 908 KB

A zoom-able Image Viewer Class for the Sencha Touch 2.0 Framework.

Home Page: http://www.sencha.com/forum/showthread.php?197903-Pinch-Image-with-carousel-and-working-fine

License: MIT License

JavaScript 100.00%

st2_imageviewer's People

Contributors

openmynet avatar sunbox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

st2_imageviewer's Issues

Translate Bug on Zoom In

If a inital scaled down image is zoomed to a scale, that there is still a translateX/Y needed, the image will be cropped on the other side.

Problem: Not correct sized figEl
Solution: A change in #adjustScroller
...
var boundWidth = Math.max(me.imgWidth * scale, me.viewportWidth);
var boundHeight = Math.max(me.imgHeight * scale, me.viewportHeight);

to

var boundWidth = Math.max(me.imgWidth * scale + 2 * me.translateX, me.viewportWidth);
var boundHeight = Math.max(me.imgHeight * scale + 2 * me.translateY, me.viewportHeight);

onZoom drag to next image

On the ImageViewer carousel example you got those listeners set:

[CODE]
onDragStart: function(e) {
var scroller = this.getActiveItem().getScrollable().getScroller();
if (e.targetTouches.length === 1 && (e.deltaX < 0 && scroller.getMaxPosition().x === scroller.position.x) || (e.deltaX > 0 && scroller.position.x === 0)) {
this.callParent(arguments);
}
},
onDrag: function(e) {
if (e.targetTouches.length == 1)
this.callParent(arguments);
},
onDragEnd: function(e) {
if (e.targetTouches.length < 2)
this.callParent(arguments);
}
[/CODE]

I am assuming this is preventing to switch to the next image in the carousel.
However, I am struggling to get those same listeners set in my config.

Within an modal container:
[CODE]
initialize: function() {
var me = this;
me.element.on({
dragstart: function(){
me.fireEvent('onDragStart');
},
drag: function() {
me.fireEvent('onDrag');
},
dragend: function() {
me.fireEvent('onDragEnd');
}
});
[/CODE]

and in the matching controller events there is the same code as in the example.
For some silly reason the scroller can not get initialized and so no checks for the drag events can be done.
any inputs or thoughts?

never mind, i did this workaround using the post as seen on
http://www.sencha.com/forum/showthread.php?197903-Pinch-Image-with-carousel-and-working-fine/page5

thanks anyway, issue can be closed/removed.

can't scroll on st2.3.1

I use it in sencha touch 2.3.1,but it can't scroll like the demo when i use it as a view ,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.