Fossil

Check-in [2a2be01319]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:pikchr mode swap: tapping on an SVG switches modes and enables the mode-select button. Leaving source view mode requires activating that button (which works like before, but is only visible in source mode).
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2a2be013199e051a1deb8668ee2aa68e25aacf9a639b69a7919ca6241993e8d1
User & Date: stephan 2020-09-17 16:52:25.965
Context
2020-09-17
17:13
pikchr source view: tentatively re-added the copy button (only in source view, not SVG), but it now switches back to SVG mode if it successfully copies the source code. ... (check-in: d369f4f389 user: stephan tags: trunk)
16:52
pikchr mode swap: tapping on an SVG switches modes and enables the mode-select button. Leaving source view mode requires activating that button (which works like before, but is only visible in source mode). ... (check-in: 2a2be01319 user: stephan tags: trunk)
16:31
Implemented most of the feedback from [https://pikchr.org/home/forumpost/f538d8e7f7], with the exceptions being documented in that thread. /pikchrshow now longer uses the mode-swap feature (seems superfluous there) and tapping anywhere in the body, outside of the source/svg container element, now turns off those buttons on all pikchrs where they are currently visible. Consolidated pikchr-rendering impl for markdown/fossil/pikchrshow/pikchr command. ... (check-in: 4f69773183 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/fossil.pikchr.js.
161
162
163
164
165
166
167










168
169
170
171
172
173
174
    D.append(parent, D.addClass(buttonBar, 'hidden'));

    parent.addEventListener('click', function f(ev){
      ev.preventDefault();
      ev.stopPropagation();
      D.toggleClass(buttonBar, 'hidden');
    }, false);











    /** Toggle the source/SVG view on click. */
    btnFlip.addEventListener('click', function f(ev){
      ev.preventDefault();
      ev.stopPropagation();
      if(!f.hasOwnProperty('origMaxWidth')){
        f.origMaxWidth = parent.style.maxWidth;







>
>
>
>
>
>
>
>
>
>







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    D.append(parent, D.addClass(buttonBar, 'hidden'));

    parent.addEventListener('click', function f(ev){
      ev.preventDefault();
      ev.stopPropagation();
      D.toggleClass(buttonBar, 'hidden');
    }, false);

    /** Show the mode-switch buttons only in source view, and switch to
        source view if the SVG is tapped. This allows easy switching to
        source view while also keeping the buttons out of the way in
        SVG mode and giving the user the option of select/copy in the
        source mode via normal text-selection approaches. */
    svg.addEventListener('click', function(ev){
      D.removeClass(buttonBar, 'hidden');
      btnFlip.click();
    }, false);

    /** Toggle the source/SVG view on click. */
    btnFlip.addEventListener('click', function f(ev){
      ev.preventDefault();
      ev.stopPropagation();
      if(!f.hasOwnProperty('origMaxWidth')){
        f.origMaxWidth = parent.style.maxWidth;
214
215
216
217
218
219
220
221
222
223
224
225
          parent.style.maxWidth = 'unset';
        }else{/*srcView is active*/
          parent.style.maxWidth = f.origMaxWidth;
          parent.style.width = 'unset';
        }
      }
      btnFlip.classList.toggle('src-active');
      D.toggleClass([svg, srcView], 'hidden');
    }, false);
  };
  
})(window.fossil);







|




224
225
226
227
228
229
230
231
232
233
234
235
          parent.style.maxWidth = 'unset';
        }else{/*srcView is active*/
          parent.style.maxWidth = f.origMaxWidth;
          parent.style.width = 'unset';
        }
      }
      btnFlip.classList.toggle('src-active');
      D.toggleClass([svg, srcView, buttonBar], 'hidden');
    }, false);
  };
  
})(window.fossil);