Is there a conflict between three.js OrbitControls and HTML5 Canvas?

I am facing some unusual behavior with my HTML5 Canvas (using Fabric.js) and a three.js object. When I use OrbitControls to rotate the 3D image, two strange things happen.

1) Drop down fields and dynamic sliders do not function properly while rotating

2) Moving an image on another canvas affects the movement of the 3D image in the three.js canvas. However, moving the 3D image does not have any impact on the image in the canvas.

If I disable or remove the rotation controls in the "Box Controller - Collada Files" controller, the dropdowns work correctly and there is no synchronization between the two images.

How can I prevent OrbitControls from interfering with dropdowns and other elements, as well as desynchronizing the movement between the image and the 3D object?

Below is a sample of my HTML:

<!DOCTYPE html>
<html lang="en" data-ng-app="appControllersBox">
... (HTML code continues)

Here is the content of my JS/Controllers2.js file which contains two Angular controllers:

    'use strict';

var appControllersBox = angular.module('appControllersBox', ['colorpicker.module']);

// Box Controller - Canvas
appControllersBox.controller('canvasCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
    ... (Canvas controller code)
}]);

// Box Controller - Collada File
appControllersBox.controller('3dboxCtrl', ['$scope', '$timeout', function ($scope, $timeout) {
    ... (Collada file controller code)
}]);

Answer №1

In the event that you are utilizing OrbitControls or TrackballControls and encounter interference with other HTML elements, make sure to include the domElement argument in the controls constructor:

controls = new THREE.OrbitControls( camera, renderer.domElement );

This information is specific to three.js version .r71

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

Include a series of HTML attributes within an HTML element

I need to take a string of attributes that are formatted in valid HTML and apply them to a specific HTML element, rather than just creating a new string with those attributes. For instance, I have a variable named attributesStr that contains the string of ...

Tampermonkey feature: Extract source code with a button click from a constantly updating AJAX page

My goal is to create a simple script that can copy the source code of a dynamic AJAX page whenever I press a button. The current code, which I have included below, seems to be working fine: // ==UserScript== // @require http://ajax.googleapis.com/ajax/li ...

Using ThreeJS to render a mesh with a curved surface in a monochromatic black and white style

How can I achieve a mesh with curved surfaces similar to the ones shown in this image? https://i.sstatic.net/bFSsv.jpg I tried using the EdgesHelper and ended up with this result: https://i.sstatic.net/nx8y8.png Then, I experimented with increasing the ...

An unanticipated issue has arisen with the Alert Open Error. The command "browser.switchTo().alert().accept();" functions properly in Firefox, but encounters difficulties in Chrome while executing via Jenkins

Seeking assistance on how to resolve a specific error encountered in the Chrome browser while using Protractor. https://i.stack.imgur.com/7Fm4l.png The error message reads as follows: "UnexpectedAlertOpenError: unexpected alert open: {Alert text : There a ...

Ways to activate flashlight on mobile using React.Js

Is it possible to control the torch light of a mobile device by toggling a button? https://i.stack.imgur.com/x9nIf.png <IconButton onClick={() => setFlashOn(!flashOn)} style={{ position: "absolute", right: 80, top: 20, zIndex: ...

Experience a different div content by simply hovering over it

Is there a way to implement a hover effect that displays an image over the entire display-div? For example, when hovering over item1, the image should cover the display-div, and when hovering over another item, the image within the display-div should chang ...

Create an array that can contain a mix of nested arrays and objects

Working on my project using Angular and TypeScript includes defining an array that can contain arrays or objects. public arrangedFooterMenu: IMenuItemType[][] | IMenuItemType[] = []; typesOfData.forEach(type => { let filteredData: IMenuItemType | ...

Dynamically removing buttons with JQuery

I am trying to dynamically add buttons to a page based on an array, but I'm running into a problem. Whenever I add a new name to the array, it prints out all of the buttons instead of just the one I added. I need help figuring out how to erase all the ...

Managing images in JavaScript while conserving memory

Welcome I am embarking on a project to construct a webpage using HTML, CSS, JavaScript (jQuery), and nearly 1000 images. The length of the HTML page is substantial, around 5000px. My vision involves creating a captivating visual experience for users as t ...

Controlling Camera Movement in THREE.js Using Mouse with Constraints

Is there a way to move the camera around my JSON scene using only mouse movements? I want the camera to follow the direction of the mouse without the need for clicking and dragging. Currently, I have a partially functioning solution, but it's not meet ...

Validation using Joi allows for a field to be optional, but if it is included, it must be a positive integer

I am facing a challenge with a field in my JOI schema that I want to make optional, allowing for both undefined and null values. However, if a value is provided, it must be a positive integer. How can I accomplish this? So far, I have attempted the follow ...

What is the best way to create synchronous AJAX requests?

Can I convert this into a function? // Function to check if station is alive function checkStation(valueSelected) { let result = false; $.ajax({ url: "lib/grab.php", data: "check_live=1&stream_url="+valueSelected, ...

How can event.target.value and event.target.checked be used simultaneously in React.js?

I have a combination of input fields including text and checkboxes. What is the best way to retrieve all the field values together? Currently, I can only get one value at a time as shown in the example below: handleChange = event => { this.setState( ...

Tips for computing values with changing ng-model identifiers

In my angular application, I have a function that creates tables using directives. Each field in the tables must have unique ng-model names so that I can calculate each table individually. To achieve this, I implemented a counter that increments with each ...

Discovering the Secrets of Accessing and Modifying Item Values in BIRT

Is it feasible to create using only Javascript without utilizing any Java functions? Is there a way to access values from elements like labels, tables, or charts by calling them from an HTML button? I am currently working with Openlayers and BIRT. I need ...

PLupload does not support Flash runtime in Internet Explorer 8

I am facing a dilemma with a basic JavaScript function placed within the $(function() { ... }); block. var uploader = new plupload.Uploader({ runtimes: 'html5,flash,silverlight', browse_button: 'pickfiles', c ...

Displaying over 20 columns of data in a webpage can be achieved effortlessly by utilizing the power of jQuery DataTables in conjunction

Hey everyone, I'm currently facing a challenge in displaying more than 20 columns using datatables on a single webpage. My tech stack includes MySQL, jQuery datatables, and HTML. This is my MySQL query: select LOT_LOCATION, `Zone Attribute`, a.LOTID, ...

Executing a function every minute and dispatching a notification

In my code, I have a function that sets up a cron job to fetch data from a table named "clients" every minute. The function then iterates over the results, checking if the current time matches the time stored in the database. If it does, it sends a messa ...

Learn how to use Angular2 or TypeScript to display 'unsubscribe' and 'subscribe' text on a toggle button

I'm working on a toggle button that initially displays the word subscribe on the thumb. When the toggle is disabled, I want it to show unsubscribe instead. Can someone please help me achieve this functionality? Here's the code snippet: <md-s ...

What are some ways to connect my CSS styles without encountering a MIME error?

Working on a Nodejs - Express - Vanillajs project, I encountered an issue when testing my routes. The index page failed to load CSS, displaying the following error message: Refused to apply style from 'http://localhost:3000/public/css/bootstrap.min. ...