mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-09 15:40:03 +00:00
Added touch support to bitmap editor
This commit is contained in:
parent
1e54001672
commit
d985f9b09e
@ -34,6 +34,29 @@ BitmapEditor.prototype.renderInDom = function() {
|
|||||||
|
|
||||||
BitmapEditor.prototype.addEventHandlers = function() {
|
BitmapEditor.prototype.addEventHandlers = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
this.macroNode.domNode.addEventListener("touchstart",function(event) {
|
||||||
|
self.brushDown = true;
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
},false);
|
||||||
|
this.macroNode.domNode.addEventListener("touchmove",function(event) {
|
||||||
|
if(self.brushDown) {
|
||||||
|
self.moveTo(event.touches[0].clientX,event.touches[0].clientY);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
},false);
|
||||||
|
this.macroNode.domNode.addEventListener("touchend",function(event) {
|
||||||
|
if(self.brushDown) {
|
||||||
|
self.brushDown = false;
|
||||||
|
self.saveChanges();
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
return false;
|
||||||
|
},false);
|
||||||
this.macroNode.domNode.addEventListener("mousedown",function(event) {
|
this.macroNode.domNode.addEventListener("mousedown",function(event) {
|
||||||
self.brushDown = true;
|
self.brushDown = true;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@ -71,7 +94,7 @@ BitmapEditor.prototype.saveChanges = function() {
|
|||||||
var tiddler = this.macroNode.store.getTiddler(this.macroNode.tiddlerTitle);
|
var tiddler = this.macroNode.store.getTiddler(this.macroNode.tiddlerTitle);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
// data URIs look like "data:<type>;base64,<text>"
|
// data URIs look like "data:<type>;base64,<text>"
|
||||||
var dataURL = this.macroNode.content[0].domNode.toDataURL(tiddler.type),
|
var dataURL = this.macroNode.content[0].domNode.toDataURL(tiddler.type,0.95),
|
||||||
posColon = dataURL.indexOf(":"),
|
posColon = dataURL.indexOf(":"),
|
||||||
posSemiColon = dataURL.indexOf(";"),
|
posSemiColon = dataURL.indexOf(";"),
|
||||||
posComma = dataURL.indexOf(","),
|
posComma = dataURL.indexOf(","),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user