What's the official way to zoom and pan the canvas in FabricJS? - fabricjs

I see for zooming and panning in Fabric JS there are the commands Canvas.setZoom, absolutePan and relativePan but can anyone show with example code how to use them, especially in using both mouse and touch events to control them?
Thanks

Related

Zoom on scroll interaction in figma

I want to build a figma prototype that will allow users to zoom in and out from one photo to another using scrolling/pinch on trackpad.
I can also make a huge photo to zoom in and out of it.
The idea is to make an interface in which zooming in and out will change photos
Any thoughts of how to do it?
Wireframe demonstration below
enter image description here

MergEXT MergZXing layer and barcode not reading

Just started working with this awesome external but have a couple of questions.
When the control is evoked, is it always the top layer or can I have a background transparent image on top of it so I can frame the control nicely?
Also, my testing seems to read most Barcodes but when it comes down to reading Barcodes on hard drives, the control does not want to decode those.... Too dense of bar code pattern?
I am very impressed thus far with the ease of use of your externals. Makes we want to code more for mobile devices!
an overlaying transparent image is not possible, as far as i know.
but couldnĀ“t you use
command mergZXingControlSetRect pLeft,pTop,pRight,pBottom
to define the rect of that scanner after creation
or
command mergZXingControlCreate pLeft,pTop,pRight,pBottom
to create the scanner control in the specified rect.
Set the rect smaller than the width and the height of the screen.
You could then use an underlying image, which is displayed outside of the scanner rect, to show the frame around scanner control. Did not test it myself, but i would assume that this should work.
Unfortunately the native controls in externals and the ones the engine provides are added as views on top of the LiveCode view. That means you can't intermingle LiveCode controls with them. One thing that some users have done is add a web view with a transparent background and a load a png image. If you create the barcode view first and the web view second then the web view will be on top.

Full screen responsive horizontal website

I am trying to find the best method in order to create a horizontal website, full screen and if possible responsive, minimum width to be for tablets. The thing is that I need also the horizontal scrolling with the mousewheel, and I saw that fullPage.js doesn't support that or at least i couldn't manage to make it work on this plugin.
Anyway, I need an idea on building the template, with full screen sections displayed inline - I will be very grateful for any tip. Thanks.
Making horizontally responsive is bit tricky and requires a lot of effort.. There can be many many design approaches for making it responsive. It can't just be described with JSFiddle snippets..
However, I have something for you that will definitely get you started with "Horizontal Responsive Layout designing"..
This is must guide / tutorial for people who want to get started with Horizontal Responsive approach
http://tympanus.net/codrops/2012/04/02/responsive-horizontal-layout/
you could use one of the tools listed in the following links
http://www.cssdesignawards.com/articles/15-excellent-jquery-plugins-to-spice-up-your-sites/44/
http://jquery-plugins.net/scrollit-js-jquery-plugin-for-scrolling-pages
or you could also mix raw js/jquery with anchor links and add animations when clicked. in taht case you can scroll down using mouse wheel and also have fancy animations when a link is clicked
regarding responsiveness use css media queries

Android wallpaper also sliding left and right when we swipe the home screen

I want to develop a new home screen application for android. I saw the default home screen in my android 2.3.3 device, when ever I swipe the home screen left and right, the background wallpaper also sliding left and right. What is that view? How to get the same effect in an app?
Is it ViewPager? I checked the ViewPager class, but I didn't found any common background image for all views in that.
You probably want to use a canvas with a draw-able, then detect the users swiping and animate it in the background. It is likely that the default android backgrounds are doing the same. You wont be drawing the unseen portions of the view.
http://developer.android.com/guide/topics/graphics/2d-graphics.html
I suggest doing their lunar lander tutorial to learn how to use the canvas first.
You will make a canvas the background to your app and then lay your other ui elements on top of it unless you make the ui based inside the canvas.

Draw over camera using JAVA ME

I'm wondering if there is anyway for drawing somethin over the videoControl.
I tried using LWUIT but I can't achieve any result, have anybody done somethin similar? Any help will be appreciate
Nope very few devices will support this. JSR135 camera viewfinder images seem to get drawn by the hardware external to Java, and it gets drawn over whatever you already have on the screen. Nothing you can do about it :(
If you're application user don't argue slow refresh rate I think you can use snapshot feature of VideoControl.
Do not show preview of VideoControl (Hide, Make it's size as zero ...)
Take snapshot from VideoControl
Draw captured image on Canvas
Draw something on it
Do it repeatedly
LWUIT do not help for this issue. It's just graphical widget library on the MIDP Canvas.

Resources