mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Rough and ready control over bitmap editor line width and colour
Fixes #414
This commit is contained in:
parent
d4baf515ed
commit
68bcbff753
@ -16,6 +16,10 @@ Edit-bitmap widget
|
||||
var DEFAULT_IMAGE_WIDTH = 300,
|
||||
DEFAULT_IMAGE_HEIGHT = 185;
|
||||
|
||||
// Configuration tiddlers
|
||||
var LINE_WIDTH_TITLE = "$:/config/BitmapEditor/LineWidth",
|
||||
LINE_COLOUR_TITLE = "$:/config/BitmapEditor/Colour";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var EditBitmapWidget = function(parseTreeNode,options) {
|
||||
@ -258,8 +262,8 @@ EditBitmapWidget.prototype.strokeMove = function(x,y) {
|
||||
// Redraw the previous image
|
||||
ctx.drawImage(this.currCanvas,0,0);
|
||||
// Render the stroke
|
||||
ctx.strokeStyle = "#ff0";
|
||||
ctx.lineWidth = 3;
|
||||
ctx.strokeStyle = this.wiki.getTiddlerText(LINE_COLOUR_TITLE,"#ff0");
|
||||
ctx.lineWidth = parseInt(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,"3"),10);
|
||||
ctx.lineCap = "round";
|
||||
ctx.lineJoin = "round";
|
||||
ctx.beginPath();
|
||||
|
3
core/wiki/config/BitmapEditorColour.tid
Normal file
3
core/wiki/config/BitmapEditorColour.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/BitmapEditor/Colour
|
||||
|
||||
#ff0
|
3
core/wiki/config/BitmapEditorLineWidth.tid
Normal file
3
core/wiki/config/BitmapEditorLineWidth.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/BitmapEditor/LineWidth
|
||||
|
||||
3
|
@ -1,7 +1,8 @@
|
||||
title: EditBitmapWidget
|
||||
created: 201310241419
|
||||
modified: 201310300837
|
||||
created: 20131024141900000
|
||||
modified: 20140221140151790
|
||||
tags: widget
|
||||
title: EditBitmapWidget
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
! Introduction
|
||||
|
||||
@ -13,3 +14,10 @@ The content of the `<$edit-bitmap>` widget is ignored.
|
||||
|
||||
|!Attribute |!Description |
|
||||
|tiddler |The tiddler to edit (defaults to the [[WidgetVariable: currentTiddler]]) |
|
||||
|
||||
! Configuration
|
||||
|
||||
The edit bitmap widget can be configured with these system tiddlers:
|
||||
|
||||
* [[$:/config/BitmapEditor/LineWidth]] determines the line width: <$edit-text tiddler="$:/config/BitmapEditor/LineWidth" tag="input"/>
|
||||
* [[$:/config/BitmapEditor/Colour]] determines the line width: <$edit-text tiddler="$:/config/BitmapEditor/Colour" tag="input" type="color"/>
|
||||
|
Loading…
Reference in New Issue
Block a user