@fortawesome/free-solid-svg-icons#faLayerGroup TypeScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faLayerGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZOrderParam.tsx    From ble with Apache License 2.0 5 votes vote down vote up
ZOrderParam: FunctionComponent<Props> = ({ entity }) => {
	const { level, undoManager } = useStore();

	const position = level.getEntityPosition(entity);

	const onChange = (newPosition: number): void => {
		level.move(entity, newPosition - 1);
	};
	const onChangeSlider = (ev: ChangeEvent<HTMLInputElement>): void => {
		level.move(entity, ev.target.valueAsNumber - 1);
	};

	function onFocus(): void {
		undoManager.startGroup();
	}
	function onBlur(): void {
		undoManager.stopGroup();
	}

	const posDisplay = position + 1;
	return (
		<Fragment>
			<Container>
				<label>
					<FontAwesomeIcon icon={faLayerGroup}/>
					&#32;
					z-order:
					&#32;
					<OrderInput
						value={posDisplay}
						min={1}
						max={level.entities.length}
						step={1}
						onChange={onChange}
						onFocus={onFocus}
						onBlur={onBlur}
					/>
				</label>
				<input
					type="range"
					min="1"
					max={level.entities.length}
					step="1"
					value={posDisplay}
					onChange={onChangeSlider}
					onFocus={onFocus}
					onBlur={onBlur}
				/>
			</Container>
			{Hoppi.is(entity) && (
				<Tip>Tip: the hoppi with the smallest z-order holds the camera</Tip>
			)}
		</Fragment>
	);
}