block-utils | Rust utilities for working with block devices | Networking library
kandi X-RAY | block-utils Summary
kandi X-RAY | block-utils Summary
Rust utilities for working with block devices
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of block-utils
block-utils Key Features
block-utils Examples and Code Snippets
Community Discussions
Trending Discussions on block-utils
QUESTION
We are developing a site using Angular 9. We have also integrated a Unity3D WebGL build in it. When I try to type something in a text/password/number input field inside one of my forms, it doesn't write anything and the field doesn't seem to receive the input; also, the variable I bound the field to is not updated with the new value. What makes it weirder is that:
- I can select the input field (it gets highlighted as if I can start typing)
- I can do
CTRL+C
on the field and what I copied somewhere else is pasted, as expected - I can use the
type="number"
arrow selectors to set the value of the field - I cannot type from the keyboard in the fields
- I can interact as expected with other form tags, such as
If I reload the page, it usually starts working as expected and I can type into the fields Here is the code from my login form (component.ts above, template HTML below) import { Component, OnInit } from '@angular/core'; import { AuthService } from '../auth.service' import { first } from 'rxjs/operators'; import { Router, ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.less'] }) export class LoginComponent implements OnInit { email: string = ""; password: string = ""; returnUrl: string = "home"; constructor(private router: Router, private route: ActivatedRoute, private authService: AuthService) { } ngOnInit(): void { let tmpReturnUrl = this.route.snapshot.queryParams["returnUrl"]; if (tmpReturnUrl != undefined) { console.log("true"); this.returnUrl = tmpReturnUrl; } else console.log("false"); setInterval(() => { console.log("EMAIL: " + this.email); }, 1000); } onSubmit(){ this.authService.login(this.email, this.password) .pipe(first()) .subscribe( result => { console.log("CAIOAOAOAOOA"); this.router.navigate([this.returnUrl]); }, err => console.log(err) ); } } Log in Email: Password: Login Sign Up
And here, the code from another form where I also use
type="number"
and(component.ts above, template HTML below) import { Component, OnInit, Output } from '@angular/core'; import { BlockFormService } from '../block-form.service'; import { BlockData } from '../blockCardData'; import { BlockUtilsService } from '../block-utils.service'; import { ApiService } from '../../core/api.service' import { NgForm } from '@angular/forms'; @Component({ selector: 'app-block-form', templateUrl: './block-form.component.html', styleUrls: ['./block-form.component.less'] }) export class BlockFormComponent implements OnInit { updateComplete : Boolean = false; materials : string[]; products : string[]; varieties : string[]; nations : string[]; // companies : {name: string, id: string}[] = []; company : string = ""; colors : string[] = ["White", "Grey", "Black", "Brown", "Red", "Green", "Yellow", "Blue"]; blockData : BlockData = {_id : "", blockId: "", company: "", material: "", product: "", variety: "", color: "", nation: "", modelName : "", imagePreview : "", price: null, blockNumber: "", length: null, height: null, width: null, weight: null }; imagePreview: File = null; zipFile: File = null; invalidUpload: boolean = false; constructor( private blockFormService: BlockFormService, public blockUtils: BlockUtilsService, private companiesUtils: ApiService ) { } ngOnInit(): void { this.materials = this.blockUtils.getMaterials(); this.colors = this.blockUtils.getColors(); this.companiesUtils.getLoggedCompany().subscribe(companiesResult => { this.blockData.company = companiesResult._id; this.company = companiesResult.name; }); } onImageSelected(event){ console.log(event.target.files[0]); if (event.target.files[0].type === "image/png") { if (this.invalidUpload) this.invalidUpload = false; this.imagePreview = event.target.files[0]; } else{ if (!this.invalidUpload) this.invalidUpload = true; event.target.value = null; } } onMaterialSet(newMaterial): void{ console.log("Material set"); this.products = this.blockUtils.getProducts(newMaterial); //console.log(this.products); // if (this.products.length > 0) // this.blockData.product = this.products[0]; // else this.blockData.product = ""; this.onProductSet(this.blockData.product); } onProductSet(newProduct): void{ console.log("Product set"); this.varieties = this.blockUtils.getVarieties(this.blockData.material, newProduct); // if (this.varieties.length > 0) // this.blockData.variety = this.varieties[0]; // else this.blockData.variety = ""; this.nations = this.blockUtils.getNations(this.blockData.material, this.blockData.product); if (this.nations.length > 0) this.blockData.nation = this.nations[0]; else this.blockData.nation = ""; this.onVarietySet(this.blockData.variety); } onVarietySet(newVariety): void{ console.log("Variety set"); // this.nations = this.blockUtils.getNations(this.blockData.material, this.blockData.product); // if (this.nations.length > 0) // this.blockData.nation = this.nations[0]; // else // this.blockData.nation = ""; } onSubmit(blockForm : NgForm, imageField, zipField): void{ this.blockFormService.sendBlock(this.blockData, this.imagePreview, this.zipFile) .subscribe(res => { console.log("Sent!"); this.updateComplete = true; }); this.blockData = { _id: "", blockId: "", company: "", material: "", product: "", variety: "", color: "", nation: "", modelName: "", imagePreview: "", price: null, blockNumber: "", length: null, height: null, width: null, weight: null }; blockForm.resetForm(); imageField.value = null; zipField.value = null; this.imagePreview = null; this.zipFile = null; } } Block added successfuly Company:
Material: {{mat}}
Product: {{prod}} Block Number: Variety: {{variety}} Color: {{col}} Nation: Price: Length: Width: Height: Weight: Upload preview image: Upload models' zip: Submit
I hope I was clear enough, any help is appreciated :)
ANSWER
Answered 2020-Aug-30 at 11:23Finally I found the source of the problem. In our website we have integrated a Unity3D WebGL build and, if I moved from the web page with Unity to the login page, the Unity process was still running. Unity had the focus of every input of the keyboard, so it was catching all the inputs.
We resolved it by quitting the Unity application when we change page. This way, input fields can receive inputs from the keyboard again.
Another solution, maybe (I have not tested it), could be to not make Unity get the inputs, as discussed in this Unity forum's thread or by setting WebGLInput.captureAllKeyboardInput to false.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install block-utils
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page