Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Zoom in and out feature

Participant ,
Nov 02, 2017 Nov 02, 2017

Hello,

Is there a  way to create a zoom in and out feature with using mouse scrolling?

Thanks

582
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 03, 2017 Nov 03, 2017

For ActionScript you could read articles like this one:

Flash Mouse Wheel Support | Hook - Labs

For HTML5 Canvas, here's what @klad suggested in another post:

document.getElementById('canvas').addEventListener('mousewheel',f.bind(this));

document.getElementById('canvas').addEventListener('DOMMouseScroll',f.bind(this));

function f(e){

//e.detail

}

Exactly like that it's not the whole answer, there is wheelDeltaY, so this will give you a useful number about how quickly the user was wheeling:

document.getEl

...
Translate
LEGEND ,
Nov 02, 2017 Nov 02, 2017

Yes, hold down the Command key (Ctrl on Windows I would think), and mouse wheel. It's a shame they didn't use the alt/option key to make it the same as Photoshop and Illustrator.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 03, 2017 Nov 03, 2017

Hello,

That is not what I meant. Can we create a zooming feature on our project. Like build one on our image so when a user runs the website they are able to zoom in and out on the image.

Thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 03, 2017 Nov 03, 2017

For ActionScript you could read articles like this one:

Flash Mouse Wheel Support | Hook - Labs

For HTML5 Canvas, here's what @klad suggested in another post:

document.getElementById('canvas').addEventListener('mousewheel',f.bind(this));

document.getElementById('canvas').addEventListener('DOMMouseScroll',f.bind(this));

function f(e){

//e.detail

}

Exactly like that it's not the whole answer, there is wheelDeltaY, so this will give you a useful number about how quickly the user was wheeling:

document.getElementById('canvas').addEventListener('mousewheel',f.bind(this));

document.getElementById('canvas').addEventListener('DOMMouseScroll',f.bind(this));

function f(e){

   alert(e.wheelDeltaY);

}

But, read articles like this about how that only works in some browsers, and for other approaches:

mousewheel - Event reference | MDN

Once you have a usable value you would then need more code to sensibly scale the image.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 03, 2017 Nov 03, 2017

Okay!

Thank you so much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 03, 2017 Nov 03, 2017
LATEST

I'll mark my new answer as correct, if that's ok!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 03, 2017 Nov 03, 2017

Please place a feature request with the team using this link Feature Request/Bug Report Form

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines