MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

touch screen



  • Re: touch screen

    you want to display a cursor on your mirror or you you want to do a touchscreen miror?



  • both basically if you get the mouse working then touchscreen works. But really i want to know how to get the mouse to show up on the screen



  • @tpot edit the main.css and comment out this

    html {
      cursor: none;   // < ---
      overflow: hidden;
      background: #000;
    }
    

    I don’t know if this will override if placed in custom.css



  • @sdetweil thanks man cant believe i missed that code thanks alot 🙂



  • this is probably a really easy thing but i cant find out how to do it. How do you create a clickable button ?



  • @tpot in html this is < button id=“xyz” onclick=“someroutine”>

    someroutine is in your javascript module.js handler

    someroutine: function(){
    the ‘this’ variable points to the button object that caused the call
    this.id equals ‘xyz’
    }

    you can also create the button with code (in the getDom function)

    let button = document.createElement(“button”)
    button.id=‘xyz’;
    button.addEventListener(‘click’,self.someroutine)
    wrapper.appendChild(button)

    here is a routine from another module to create a button object with an icon, and some data (src attribute) to be used when the button is pushed

    	createVideoButton: function(video, height, width) {
    			let button = document.createElement("button");
    			button.className = "button";
    		    button.setAttribute("data-video-src", "modules/" + self.name + "/" + this.config.videoDir + "/" + video);
    		    button.addEventListener("click", self.swapVideo);
    		    
    			let img = document.createElement("img");
    			img.src = "modules/" + self.name + "/" + this.config.posterDir + "/" + self.Hash[video.substring(0, video.indexOf('.'))];
    			img.width = width;
    			img.height = height;
    		    button.appendChild(img);
    		return button;
    	},
    	swapVideo: function () {
    		Log.log("in handler for button="+this.getAttribute("data-video-src"));
    		self.player.src = this.getAttribute("data-video-src");
    		self.player.load();
    		self.player.controls = true;
    		self.player.play();
    	},
    

Log in to reply