Figma Layer Panel Horizontal Scroll Fix

Improves horizontal scrolling in Figma's layer panel

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Figma Layer Panel Horizontal Scroll Fix
// @name:zh-TW   Figma 圖層面板水平捲動修復
// @author       gstar
// @license      MIT
// @namespace    https://github.com/gstar175/
// @version      0.0.1
// @description  Improves horizontal scrolling in Figma's layer panel
// @description:zh-TW  改善 Figma 圖層面板的水平捲動功能
// @match        https://www.figma.com/design/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  // 創建樣式元素
  const style = document.createElement('style');
  style.textContent = `
      [class^="pages_panel--objectPanelContent"] [class^="scroll_container--scrollContainer"] {
          overflow-x: scroll !important;
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [data-testid="layer-row"], 
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [data-testid="layer-row-with-children"] {
          min-width: fit-content;
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--rowText"] {
          width: auto !important;
          min-width: fit-content;
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--rowName"] {
          min-width: fit-content;
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--row"] input[type="text"] {
          width: auto !important;
          min-width: fit-content;
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--rowActions"] {
          position: sticky;
          right: 0;
          padding-left: 0.25rem;
          background-color: var(--color-bg, #fff);
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--row"][class*="selected"] [class^="object_row--rowActions"] {
          background-color: var(--color-bg-selected, #daebf7);
      }
      [class^="pages_panel--objectPanelContent"] [class^="objects_panel--rowContainer"] [class^="object_row--row"][class*="parentSelected"] [class^="object_row--rowActions"] {
          background-color: var(--color-bg-selected-secondary, #edf5fa);
      }
  `;

  // 將樣式添加到文檔頭部
  document.head.appendChild(style);
})();