Restrict magnification in THREE.js mousewheel interaction

Seeking advice on limiting zoom in and out of a model in three.js. I have explored trackball controls, but couldn't find a way to restrict zooming. I also experimented with orbit controls, but encountered issues when combined with trackball controls related to rotation and panning.

Appreciate any help in advance.

Answer №1

Recently, I encountered an issue while working with THREE.js version 70 where there was no built-in support to limit the zooming functionality. However, in the latest version (83) of Trackball controls in THREE.js, we can easily restrict the zooming range by adding the following code snippet:

controls.minDistance = 10;
controls.maxDistance = 100;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discover the highest value within an array of objects, along with any numerical object attributes that have a value greater than zero

Considering an array of objects structured as follows: [{ "202201": { "WO": 900, "WS": 0, "SY": 0.915, "LY": 0.98, "CT": 75 }, "202202" ...

Link a timestamp to a datetime-local input using ng-model

My challenge is to display an <input type="datetime-local> field using the ng-model attribute to represent a timestamp: <input type="datetime-local" ng-model="object.value"> This is being achieved with: $scope.object.value = 1433109600000; ...

Leveraging Angular to incorporate HTML templates from one component into another component

I am currently working with two components. The first one is a table component, identified by the selector 'table-component', which has standard filtering capabilities. The second component is designed for displaying the table on a page. This me ...

Determine if every object in the array contains a specific key value pair

I am dealing with the following JSON data: { records:{ data:{ current:{ records:{ '2years':[{a:1, b:2, flag:true}, {a:2, b:4}, ...

Tips for sending dynamic column and row information to antd table

https://i.sstatic.net/XY9Zt.png The following code does not seem to work for an array containing rows and columns Below is an example using antd: const data = []; for (let i = 0; i < 4; i++) { data.push({ key: i, name: `Edward King ${i}`, ...

Tips for executing a function in jQuery when a Pop up appears

I am currently utilizing the AjaxToolKit:ModelPopUpExtender to generate a popup within an asp.net application. At first, the asp:Panel (which holds the content of the popup) is set as <asp:Panel ID="PanlUpdate" runat="server" CssClass="Popup" align="c ...

Displaying a single image on various surfaces of a BoxGeometry in Three.js

I am currently utilizing three.js to generate 3D Objects. My goal is to develop a 3D canvas similar to the one showcased here in my project. I aim to display a single image on all sides of the object (box) except for the back. I came across a relevant exa ...

Sequelize encountered an error: getaddrinfo ENOTFOUND (even though the address is correct)

I've encountered some Sequelize errors while attempting to deploy a site I developed using Angular and Express/Sequelize. Here's the issue: Everything works perfectly on my local WAMP server, connecting to the local database without any problems ...

Issue encountered while selecting the Electron app menu item

I encountered an error when clicking on a menu item: Any suggestions on how to resolve this issue? Here is the snippet of code that seems to be causing the problem: Main.js const { Menu } = require('electron') const { createNewFile } = require ...

Tips for maintaining the chat scroll position while typing on mobile devices

Check out this example page: https://codesandbox.io/s/summer-flower-uxw47?file=/index.html:4175-4223 The issue at hand is that when accessing the site from a mobile device and tapping on the input field, the keyboard pops up. This causes the text in the m ...

Using C# ASP.NET to create an array that corresponds to a JavaScript array

I am trying to figure out how to assign an array in my C# code behind and call a JavaScript function that uses that array. The JavaScript function looks like this: <script type="text/javascript"> var TotalData = new Array(); function S ...

Leveraging personalized AngularJS directives in conjunction with ExpressJS routing

I built my own AngularJS application following a tutorial at . However, I encountered an issue when trying to integrate it with an ExpressJS/Node backend. The tutorial only covers a single view with a single controller, while my Angular app includes multip ...

What is the best way to determine if any of the list items (li's) have been marked as selected?

<div id='identifier'> <ul id='list'> <li id='1' class="">a</li> <li id='2' class="">a</li> <li id='3' class="">a</li> <li id='4' class=" ...

Guide to inserting an HTML file into an article's content

After downloading an extension from freefrontedit and uploading it to my server in the directory /accordeon, I successfully accessed it by pointing my browser to . However, I am now faced with the challenge of loading the index.html into my Joomla article ...

Can directives be inserted within the v-html directive?

I am currently working on some web features, but I have encountered a problem. I was trying to create multiple HTML structures that include Vue directives with v-html, but I couldn't figure it out. So, does anyone know how to render Vue directives wit ...

The Angular ui-calendar introduces an innovative approach to event addition, providing users with

I need help with adding events to the angular ui calendar. Currently, I am using $scope.events.push() method to add events, but they get reset when changing the month. If anyone has experience with angular ui-calendar and event addition, please provide ...

An error has occurred in the Next.js App: createContext function is not defined

While developing a Next.js application, I keep encountering the same error message TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_0__.createContext) is not a function every time I try to run my app using npm run dev. This issue arises when attempting to co ...

Tips on causing a forEach loop to pause for a regex substitution to occur

I have a project in progress for an email web app where I am working on replacing certain keywords (first name, last name, email) with the actual properties of the user. As of now, I am going through a list of recipients and modifying the email content to ...

Set a class for the active menu item using jQuery based on the current window location

I have an HTML snippet here with a class called js-nav and a custom attribute named data-id. This data is crucial for determining the current sliding menu. <a class="nav-link js-nav" data-id="about" href="/#about">About</a> The approach I too ...

Using Jquery and CSS to display or conceal table elements depending on viewport width

I am seeking advice for my issue. Here is the code snippet on JSFiddle. I have a list of models and corresponding values that vary across different categories. I have created a simple table to display this data. However, I need to alter the table structur ...