Code Duplication    Length = 42-42 lines in 2 locations

public/js/tinymce/themes/inlite/theme.js 1 location

@@ 2401-2442 (lines=42) @@
2398
        self$$1.moveTo(rect.x + dx, rect.y + dy);
2399
        return self$$1;
2400
      },
2401
      moveTo: function (x, y) {
2402
        var self$$1 = this;
2403
        function constrain(value, max, size) {
2404
          if (value < 0) {
2405
            return 0;
2406
          }
2407
          if (value + size > max) {
2408
            value = max - size;
2409
            return value < 0 ? 0 : value;
2410
          }
2411
          return value;
2412
        }
2413
        if (self$$1.settings.constrainToViewport) {
2414
          var viewPortRect = getViewPortRect(this);
2415
          var layoutRect = self$$1.layoutRect();
2416
          x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
2417
          y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
2418
        }
2419
        var uiContainer = UiContainer.getUiContainer(self$$1);
2420
        if (uiContainer && isStatic(uiContainer) && !isFixed(self$$1)) {
2421
          x -= uiContainer.scrollLeft;
2422
          y -= uiContainer.scrollTop;
2423
        }
2424
        if (uiContainer) {
2425
          x += 1;
2426
          y += 1;
2427
        }
2428
        if (self$$1.state.get('rendered')) {
2429
          self$$1.layoutRect({
2430
            x: x,
2431
            y: y
2432
          }).repaint();
2433
        } else {
2434
          self$$1.settings.x = x;
2435
          self$$1.settings.y = y;
2436
        }
2437
        self$$1.fire('move', {
2438
          x: x,
2439
          y: y
2440
        });
2441
        return self$$1;
2442
      }
2443
    };
2444
2445
    var Tooltip = Control$1.extend({

public/js/tinymce/themes/modern/theme.js 1 location

@@ 1385-1426 (lines=42) @@
1382
        self$$1.moveTo(rect.x + dx, rect.y + dy);
1383
        return self$$1;
1384
      },
1385
      moveTo: function (x, y) {
1386
        var self$$1 = this;
1387
        function constrain(value, max, size) {
1388
          if (value < 0) {
1389
            return 0;
1390
          }
1391
          if (value + size > max) {
1392
            value = max - size;
1393
            return value < 0 ? 0 : value;
1394
          }
1395
          return value;
1396
        }
1397
        if (self$$1.settings.constrainToViewport) {
1398
          var viewPortRect = getViewPortRect(this);
1399
          var layoutRect = self$$1.layoutRect();
1400
          x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
1401
          y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
1402
        }
1403
        var uiContainer = UiContainer.getUiContainer(self$$1);
1404
        if (uiContainer && isStatic(uiContainer) && !isFixed(self$$1)) {
1405
          x -= uiContainer.scrollLeft;
1406
          y -= uiContainer.scrollTop;
1407
        }
1408
        if (uiContainer) {
1409
          x += 1;
1410
          y += 1;
1411
        }
1412
        if (self$$1.state.get('rendered')) {
1413
          self$$1.layoutRect({
1414
            x: x,
1415
            y: y
1416
          }).repaint();
1417
        } else {
1418
          self$$1.settings.x = x;
1419
          self$$1.settings.y = y;
1420
        }
1421
        self$$1.fire('move', {
1422
          x: x,
1423
          y: y
1424
        });
1425
        return self$$1;
1426
      }
1427
    };
1428
1429
    var global$a = tinymce.util.Tools.resolve('tinymce.util.Class');