MCPcopy
hub / github.com/viliusle/miniPaint / mousedown

Method mousedown

src/js/tools/bulge_pinch.js:37–63  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

35 }
36
37 mousedown(e) {
38 this.started = false;
39 var mouse = this.get_mouse_info(e);
40 var params = this.getParams();
41 if (mouse.click_valid == false) {
42 return;
43 }
44 if (config.layer.type != 'image') {
45 alertify.error('This layer must contain an image. Please convert it to raster to apply this tool.');
46 return;
47 }
48 this.started = true;
49
50 //get canvas from layer
51 this.tmpCanvas = document.createElement('canvas');
52 this.tmpCanvasCtx = this.tmpCanvas.getContext("2d");
53 this.tmpCanvas.width = config.layer.width_original;
54 this.tmpCanvas.height = config.layer.height_original;
55 this.tmpCanvasCtx.drawImage(config.layer.link, 0, 0);
56
57 //apply
58 this.bulgePinch_general(mouse, params.power, params.radius, params.bulge);
59
60 //register tmp canvas for faster redraw
61 config.layer.link_canvas = this.tmpCanvas;
62 config.need_render = true;
63 }
64
65 mouseup(e) {
66 if (this.started == false) {

Callers

nothing calls this directly

Calls 3

bulgePinch_generalMethod · 0.95
get_mouse_infoMethod · 0.80
getParamsMethod · 0.80

Tested by

no test coverage detected