Jump to content

Search the Community

Showing results for tags 'pixi zoom wheel mouse'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi, The code is available here https://jsbin.com/hazogar/edit?html,js,output What I do not understand is that initial behavior is not correct, past the first zoom, it will jump/jag then be proper to zoom to a point of the object. I am zooming content inside container, so what am I missing ? var initZoom = function(app, objectDocument) { var inZoomMode = true; var content = objectDocument.view; var container = objectDocument.board; var scale = { x: content.scale.x, y: content.scale.y }; var zoom = function(x, y, isZoomIn) { var globalPosition = app.renderer.plugins.interaction.eventData.data.global; if (!globalPosition) { return; } var containerPosition = container.toLocal(globalPosition, app.stage); var contentPosition = content.toLocal(containerPosition, container); var direction = isZoomIn ? 1 : -1; var factor = (1 + direction * 0.01); var nextScaleX = content.scale.x * factor; var nextScaleY = content.scale.y * factor; var p = contentPosition; console.debug('>> P', p.x, p.y); var mat = new PIXI.Matrix(); mat.translate(-p.x, -p.y); mat.scale(nextScaleX, nextScaleY); mat.translate(p.x, p.y); content.transform.setFromMatrix(mat); content.updateTransform(); }; documentView.on('mousewheel', function(e, delta) { if (!inZoomMode) { return; } zoom(e.clientX, e.clientY, delta > 0); }); }; Thank you!
×
×
  • Create New...