MCPcopy Create free account
hub / github.com/devforth/painterro / handleMouseDown

Method handleMouseDown

js/selecter.js:247–314  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

245 }
246
247 handleMouseDown(event) {
248
249 const mainClass = event.target.classList[0];
250 const mousDownCallbacks = {
251 'ptro-crp-el': () => {
252 if (this.area.activated) {
253 if (this.imagePlaced) {
254 this.finishPlacing();
255 }
256 const x = (event.clientX - this.main.elLeft()) +
257 this.main.scroller.scrollLeft;
258 const y = (event.clientY - this.main.elTop()) +
259 this.main.scroller.scrollTop;
260
261 this.setLeft(x);
262 this.setTop(y);
263 this.setRight(this.area.el.clientWidth - x);
264 this.setBottom(this.area.el.clientHeight - y);
265
266 this.reCalcCropperCords();
267 this.area.resizingB = true;
268 this.area.resizingR = true;
269 this.hide();
270 }
271 },
272 'ptro-crp-rect': () => {
273 this.area.moving = true;
274 this.area.xHandle = (event.clientX - this.rectLeft()) +
275 this.main.scroller.scrollLeft;
276 this.area.yHandle = (event.clientY - this.rectTop()) +
277 this.main.scroller.scrollTop;
278 },
279 'ptro-crp-tr': () => {
280 this.area.resizingT = true;
281 this.area.resizingR = true;
282 },
283 'ptro-crp-br': () => {
284 this.area.resizingB = true;
285 this.area.resizingR = true;
286 },
287 'ptro-crp-bl': () => {
288 this.area.resizingB = true;
289 this.area.resizingL = true;
290 },
291 'ptro-crp-tl': () => {
292 this.area.resizingT = true;
293 this.area.resizingL = true;
294 },
295 'ptro-crp-t': () => {
296 this.area.resizingT = true;
297 },
298 'ptro-crp-r': () => {
299 this.area.resizingR = true;
300 },
301 'ptro-crp-b': () => {
302 this.area.resizingB = true;
303 },
304 'ptro-crp-l': () => {

Callers

nothing calls this directly

Calls 11

finishPlacingMethod · 0.95
setLeftMethod · 0.95
setTopMethod · 0.95
setRightMethod · 0.95
setBottomMethod · 0.95
reCalcCropperCordsMethod · 0.95
hideMethod · 0.95
rectLeftMethod · 0.95
rectTopMethod · 0.95
elLeftMethod · 0.80
elTopMethod · 0.80

Tested by

no test coverage detected