當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript dom.toggleClass函數代碼示例

本文整理匯總了TypeScript中vs/base/browser/dom.toggleClass函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript toggleClass函數的具體用法?TypeScript toggleClass怎麽用?TypeScript toggleClass使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了toggleClass函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: create

	protected create(parent: HTMLElement): void {
		this.titleContainer = parent;
		this.titleContainer.draggable = true;

		//Container listeners
		this.registerContainerListeners();

		// Gesture Support
		Gesture.addTarget(this.titleContainer);

		const labelContainer = document.createElement('div');
		addClass(labelContainer, 'label-container');
		this.titleContainer.appendChild(labelContainer);

		// Editor Label
		this.editorLabel = this._register(this.instantiationService.createInstance(ResourceLabel, labelContainer, void 0));
		this._register(this.editorLabel.onClick(e => this.onTitleLabelClick(e)));

		// Breadcrumbs
		this.createBreadcrumbsControl(labelContainer, { showFileIcons: false, showSymbolIcons: true, showDecorationColors: false, breadcrumbsBackground: editorBackground });
		toggleClass(this.titleContainer, 'breadcrumbs', Boolean(this.breadcrumbsControl));
		this.toDispose.push({ dispose: () => removeClass(this.titleContainer, 'breadcrumbs') }); // import to remove because the container is a shared dom node

		// Right Actions Container
		const actionsContainer = document.createElement('div');
		addClass(actionsContainer, 'title-actions');
		this.titleContainer.appendChild(actionsContainer);

		// Editor actions toolbar
		this.createEditorActionsToolBar(actionsContainer);
	}
開發者ID:developers23,項目名稱:vscode,代碼行數:31,代碼來源:noTabsTitleControl.ts

示例2: _sliderMouseDown

	private _sliderMouseDown(e: StandardMouseEvent): void {
		if (e.leftButton) {
			let initialMouseOrthogonalPosition = this._sliderOrthogonalMousePosition(e);
			let initialScrollPosition = this._getScrollPosition();
			let draggingDelta = this._sliderMousePosition(e) - this._scrollbarState.getSliderPosition();
			DomUtils.toggleClass(this.slider, 'active', true);

			this._mouseMoveMonitor.startMonitoring(
				standardMouseMoveMerger,
				(mouseMoveData: IStandardMouseMoveEventData) => {
					let mouseOrthogonalPosition = this._sliderOrthogonalMousePosition(mouseMoveData);
					let mouseOrthogonalDelta = Math.abs(mouseOrthogonalPosition - initialMouseOrthogonalPosition);
					// console.log(initialMouseOrthogonalPosition + ' -> ' + mouseOrthogonalPosition + ': ' + mouseOrthogonalDelta);
					if (Platform.isWindows && mouseOrthogonalDelta > MOUSE_DRAG_RESET_DISTANCE) {
						// The mouse has wondered away from the scrollbar => reset dragging
						this.setDesiredScrollPosition(initialScrollPosition);
					} else {
						let desiredSliderPosition = this._sliderMousePosition(mouseMoveData) - draggingDelta;
						this.setDesiredScrollPosition(this._scrollbarState.convertSliderPositionToScrollPosition(desiredSliderPosition));
					}
				},
				() => {
					DomUtils.toggleClass(this.slider, 'active', false);
					this._parent.onDragEnd();
				}
			);

			e.preventDefault();
			this._parent.onDragStart();
		}
	}
開發者ID:ErickWendel,項目名稱:vscode,代碼行數:31,代碼來源:abstractScrollbar.ts

示例3: redraw

	private redraw(): void {
		const editor = this.group.activeEditor;
		this.lastRenderedActiveEditor = editor;

		const isEditorPinned = this.group.isPinned(this.group.activeEditor);
		const isGroupActive = this.accessor.activeGroup === this.group;

		// Update Breadcrumbs
		if (this.breadcrumbsControl) {
			if (isGroupActive) {
				this.breadcrumbsControl.update();
				toggleClass(this.breadcrumbsControl.domNode, 'preview', !isEditorPinned);
			} else {
				this.breadcrumbsControl.hide();
			}
		}

		// Clear if there is no editor
		if (!editor) {
			removeClass(this.titleContainer, 'dirty');
			this.editorLabel.clear();
			this.clearEditorActionsToolbar();
		}

		// Otherwise render it
		else {
			// Dirty state
			this.updateEditorDirty(editor);

			// Editor Label
			const resource = toResource(editor, { supportSideBySide: true });
			const name = editor.getName() || '';

			const { labelFormat } = this.accessor.partOptions;
			let description: string;
			if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
				description = ''; // hide description when showing breadcrumbs
			} else if (labelFormat === 'default' && !isGroupActive) {
				description = ''; // hide description when group is not active and style is 'default'
			} else {
				description = editor.getDescription(this.getVerbosity(labelFormat)) || '';
			}

			let title = editor.getTitle(Verbosity.LONG);
			if (description === title) {
				title = ''; // dont repeat what is already shown
			}

			this.editorLabel.setLabel({ name, description, resource }, { title, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
			if (isGroupActive) {
				this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND);
			} else {
				this.editorLabel.element.style.color = this.getColor(TAB_UNFOCUSED_ACTIVE_FOREGROUND);
			}

			// Update Editor Actions Toolbar
			this.updateEditorActionsToolbar();
		}
	}
開發者ID:developers23,項目名稱:vscode,代碼行數:59,代碼來源:noTabsTitleControl.ts

示例4:

		this._requestModificationFrame(() => {
			StyleMutator.setWidth(this._domNode, this._width);
			dom.toggleClass(this._domNode, ClassNames.SCROLL_DECORATION, this._shouldShow);
		});
開發者ID:1424667164,項目名稱:vscode,代碼行數:4,代碼來源:scrollDecoration.ts

示例5: enabled

	public set enabled(value: boolean) {
		dom.toggleClass(this.container, 'disabled', !value);
		this.selectElement.disabled = !value;
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:4,代碼來源:selectBox.ts

示例6: handleBreadcrumbsEnablementChange

	protected handleBreadcrumbsEnablementChange(): void {
		toggleClass(this.titleContainer, 'breadcrumbs', Boolean(this.breadcrumbsControl));
		this.redraw();
	}
開發者ID:developers23,項目名稱:vscode,代碼行數:4,代碼來源:noTabsTitleControl.ts

示例7: render

	public render(ctx: IRestrictedRenderingContext): void {
		StyleMutator.setWidth(this._domNode, this._width);
		dom.toggleClass(this._domNode, ClassNames.SCROLL_DECORATION, this._shouldShow);
	}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:4,代碼來源:scrollDecoration.ts

示例8:

				() => {
					DomUtils.toggleClass(this.slider, 'active', false);
					this._parent.onDragEnd();
				}
開發者ID:ErickWendel,項目名稱:vscode,代碼行數:4,代碼來源:abstractScrollbar.ts


注:本文中的vs/base/browser/dom.toggleClass函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。