issue173:inkscape
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue173:inkscape [2021/09/28 18:08] – d52fr | issue173:inkscape [2021/10/03 17:34] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
The style of each object is the same, and that information is stored in the element’s “style” property, as Inkscape does by default. Looking at the first row, therefore, the structure of the SVG content boils down to something like that shown top right.** | The style of each object is the same, and that information is stored in the element’s “style” property, as Inkscape does by default. Looking at the first row, therefore, the structure of the SVG content boils down to something like that shown top right.** | ||
+ | |||
+ | La dernière fois, je me suis livré à un rapide tour du support CSS dans les fichiers SVG, en préparation du sujet de ce mois-ci : le dialogue Sélecteurs et CSS. Comme je l'ai indiqué précédemment, | ||
+ | |||
+ | Pour décrire le fonctionnement de cette boîte de dialogue, il faut disposer d'un document type sur lequel travailler - de préférence un document comportant un mélange d' | ||
+ | |||
+ | Le style de chaque objet est le même et cette information est stockée dans la propriété « style » de l' | ||
+ | |||
**As usual, I’ve omitted a lot of the SVG content for clarity, including additional style properties and the namespaces of most of the elements and attributes. Note the first path, however, where I have specifically included the sodipodi: | **As usual, I’ve omitted a lot of the SVG content for clarity, including additional style properties and the namespaces of most of the elements and attributes. Note the first path, however, where I have specifically included the sodipodi: | ||
Ligne 10: | Ligne 17: | ||
The buttons in the bottom-right corner can be used to switch between horizontal and vertical orientation – though in both cases, in my opinion, the panels are presented in the wrong order. The only other interactive elements at this stage are the plus and minus buttons in the bottom-right corner. The latter does nothing right now (and should probably be disabled), leaving us with little to do but press the plus (+) button. This will open a small “CSS Selector” dialog, pre-filled with a class name (including the preceding dot, as required in CSS syntax).** | The buttons in the bottom-right corner can be used to switch between horizontal and vertical orientation – though in both cases, in my opinion, the panels are presented in the wrong order. The only other interactive elements at this stage are the plus and minus buttons in the bottom-right corner. The latter does nothing right now (and should probably be disabled), leaving us with little to do but press the plus (+) button. This will open a small “CSS Selector” dialog, pre-filled with a class name (including the preceding dot, as required in CSS syntax).** | ||
+ | |||
+ | Comme d' | ||
+ | |||
+ | Il est maintenant temps d' | ||
+ | |||
+ | Les boutons dans le coin inférieur droit peuvent être utilisés pour passer de l' | ||
+ | |||
**Let’s just run with this for now, accepting the default selector value by clicking the Add button. Brace yourself for the overwhelming complexity of the change it makes to the main dialog. | **Let’s just run with this for now, accepting the default selector value by clicking the Add button. Brace yourself for the overwhelming complexity of the change it makes to the main dialog. | ||
Ligne 15: | Ligne 29: | ||
The purpose of this button is to add the class name to any selected SVG elements, causing them to match the CSS selector and appear in the dialog. Let’s look at a practical example by selecting the first element from each row. Remember that each row is a separate group, so we have to hold Ctrl+Shift to select an object within the group (Ctrl) and add to the existing selection (Shift). With those keys held, it’s a simple task to click on the first object in each row, giving us a selection of four items. Clicking on the plus button now will add the “Class1” class to each of the elements, and the Selectors dialog updates to show us the IDs of the elements that match the selector.** | The purpose of this button is to add the class name to any selected SVG elements, causing them to match the CSS selector and appear in the dialog. Let’s look at a practical example by selecting the first element from each row. Remember that each row is a separate group, so we have to hold Ctrl+Shift to select an object within the group (Ctrl) and add to the existing selection (Shift). With those keys held, it’s a simple task to click on the first object in each row, giving us a selection of four items. Clicking on the plus button now will add the “Class1” class to each of the elements, and the Selectors dialog updates to show us the IDs of the elements that match the selector.** | ||
+ | |||
+ | Pour l' | ||
+ | |||
+ | Lorsque vous serez complètement remis de cette excitation, vous voudrez peut-être prendre un moment pour vraiment apprécier ce qui s'est passé : il y a maintenant une entrée dans le panneau de droite étiquetée « .Class1 » et avec un autre bouton « plus » à côté ! Vous pouvez sélectionner la nouvelle ligne, mais un double-clic ne vous permettra pas de modifier la valeur ; il n'y a aucun moyen de modifier un sélecteur une fois qu'il a été ajouté, aussi, si vous faites une erreur, votre seul recours est de le supprimer et de recommencer. En parlant de suppression, | ||
+ | |||
+ | Le but de ce bouton est d' | ||
+ | |||
**In the XML code those elements now look something like this: | **In the XML code those elements now look something like this: | ||
Ligne 23: | Ligne 44: | ||
The left pane shows the CSS properties that apply to the currently selected elements, in this case reflecting the stylesheet that Inkscape has created in the head of the document. The plus button lets us add more properties. The UI is a little clunky, but when you click the button, a new blank entry will be created with the property name field focused, ready for you to type into. Put in the property name, then press Enter or Tab to move to the value field, where you can type a suitable value for your property. Here, for example, is what happens to our selection when I set a couple of CSS colors, one for the stroke and another for the fill.** | The left pane shows the CSS properties that apply to the currently selected elements, in this case reflecting the stylesheet that Inkscape has created in the head of the document. The plus button lets us add more properties. The UI is a little clunky, but when you click the button, a new blank entry will be created with the property name field focused, ready for you to type into. Put in the property name, then press Enter or Tab to move to the value field, where you can type a suitable value for your property. Here, for example, is what happens to our selection when I set a couple of CSS colors, one for the stroke and another for the fill.** | ||
+ | |||
+ | Dans le code XML, ces éléments ressemblent maintenant à quelque chose comme ceci : | ||
+ | |||
+ | <rect class=" | ||
+ | |||
+ | Notez qu' | ||
+ | |||
+ | Le volet de gauche affiche les propriétés CSS qui s' | ||
+ | |||
**Each property has a button, which can be used to remove it completely, and a checkbox that can be used to toggle it on and off. But these don’t necessarily work the way you might expect. In this example, you might think that turning off (or deleting) the fill property would revert the objects back to their previous red fill, but that’s not the case at all. Instead the fill changes to black. | **Each property has a button, which can be used to remove it completely, and a checkbox that can be used to toggle it on and off. But these don’t necessarily work the way you might expect. In this example, you might think that turning off (or deleting) the fill property would revert the objects back to their previous red fill, but that’s not the case at all. Instead the fill changes to black. | ||
Ligne 29: | Ligne 59: | ||
In this case, it means that the red fill from the style attribute was removed as soon as the yellow fill was added to the stylesheet. Turn that entry off, however, and Inkscape no longer has any idea what fill color to use. In that case the SVG spec is quite clear: the initial value for fill – the one that Inkscape falls back to – is black. The spec also defines the initial value for stroke to be “none” - so disabling or deleting the stroke property actually results in the whole stroke being removed, rather than a thick black stroke remaining.** | In this case, it means that the red fill from the style attribute was removed as soon as the yellow fill was added to the stylesheet. Turn that entry off, however, and Inkscape no longer has any idea what fill color to use. In that case the SVG spec is quite clear: the initial value for fill – the one that Inkscape falls back to – is black. The spec also defines the initial value for stroke to be “none” - so disabling or deleting the stroke property actually results in the whole stroke being removed, rather than a thick black stroke remaining.** | ||
+ | |||
+ | Chaque propriété possède un bouton, qui permet de la supprimer complètement, | ||
+ | |||
+ | Qu' | ||
+ | |||
+ | Dans ce cas, cela signifie que le remplissage rouge de l' | ||
+ | |||
**Side effects like this mean that working with the Selectors dialog can be a little tricky if you’re not careful, or don’t have a thorough understanding of the SVG and CSS rules. It’s easy to assume that you can add a fill color, then just delete it to revert your change if you want, but, as this example demonstrates, | **Side effects like this mean that working with the Selectors dialog can be a little tricky if you’re not careful, or don’t have a thorough understanding of the SVG and CSS rules. It’s easy to assume that you can add a fill color, then just delete it to revert your change if you want, but, as this example demonstrates, | ||
Ligne 35: | Ligne 72: | ||
The left pane now shows not only the rules that are applied due to the new class that was added, but also those that are defined in the style attribute on the object itself in a section labelled “element”. You can edit existing values, or add new ones via this part of the dialog. If we set the fill color on the element itself, you’ll also note that the value supplied by the class – the one from the stylesheet – acquires a strike-through to indicate that the property has been overridden by another one.** | The left pane now shows not only the rules that are applied due to the new class that was added, but also those that are defined in the style attribute on the object itself in a section labelled “element”. You can edit existing values, or add new ones via this part of the dialog. If we set the fill color on the element itself, you’ll also note that the value supplied by the class – the one from the stylesheet – acquires a strike-through to indicate that the property has been overridden by another one.** | ||
+ | |||
+ | Les effets secondaires de ce genre signifient que le travail avec la boîte de dialogue Sélecteurs peut être un peu délicat si vous n' | ||
+ | |||
+ | Les deux règles étant réactivées, | ||
+ | |||
+ | Le volet de gauche affiche maintenant non seulement les règles qui sont appliquées en raison de la nouvelle classe ajoutée, mais aussi celles qui sont définies dans l' | ||
+ | |||
**Hopefully you can now see why I think these panes are in the wrong order: you first have to select an item in the right-hand pane in order to populate the content in the left one, whereas conventional left-to-right UI design (for an LTR based language) would suggest the pane in which you perform the action should be to the left of the one which reacts to that action. | **Hopefully you can now see why I think these panes are in the wrong order: you first have to select an item in the right-hand pane in order to populate the content in the left one, whereas conventional left-to-right UI design (for an LTR based language) would suggest the pane in which you perform the action should be to the left of the one which reacts to that action. | ||
Ligne 41: | Ligne 85: | ||
Next time, we’ll add a few more items to our selection, look at how best to use this dialog as a replacement for the old “Selection Sets” feature, and begin to explore some of the more varied CSS selectors that can be used in this dialog – albeit with some pretty big caveats!** | Next time, we’ll add a few more items to our selection, look at how best to use this dialog as a replacement for the old “Selection Sets” feature, and begin to explore some of the more varied CSS selectors that can be used in this dialog – albeit with some pretty big caveats!** | ||
+ | |||
+ | J' | ||
+ | |||
+ | En plus des boutons permettant de supprimer des propriétés individuelles, | ||
+ | |||
+ | La prochaine fois, nous ajouterons quelques éléments supplémentaires à notre sélection, nous verrons comment utiliser au mieux cette boîte de dialogue en remplacement de l' | ||
issue173/inkscape.1632845306.txt.gz · Dernière modification : 2021/09/28 18:08 de d52fr