@threedddplus/logoeditor 0.0.78 → 0.0.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4689,41 +4689,33 @@ var initCanvas = function initCanvas() {
4689
4689
  var onObjectMoving = function onObjectMoving(e) {
4690
4690
  use3dddPlus.getState().updateModifaction(false);
4691
4691
  var obj = e.target;
4692
- if (isNaN(obj.left)) {
4693
- obj.left = -1;
4694
- obj.setCoords();
4692
+ var offsetLeft = 10;
4693
+ var offsetTop = 20;
4694
+ obj.setCoords();
4695
+ // var curZoom = obj.canvas.getZoom();
4696
+ if (obj.getScaledWidth() > obj.canvas.width) {
4697
+ //Objct width is too big
4698
+ // obj.scaleToWidth(obj.canvas.width - 100);
4699
+ return;
4695
4700
  }
4696
- if (isNaN(obj.top)) {
4697
- obj.top = -1;
4698
- obj.setCoords();
4701
+ if (obj.getScaledHeight() > obj.canvas.height) {
4702
+ //Objct height is too big
4703
+ // obj.scaleToHeight(obj.canvas.height - 100);
4704
+ return;
4699
4705
  }
4700
- console.log(e);
4701
- // if (
4702
- // obj.getBoundingRect().width > obj.canvas.height ||
4703
- // obj.getBoundingRect().height > obj.canvas.width
4704
- // ) {
4705
- // return;
4706
- // }
4707
- obj.setCoords();
4708
- if (obj.getBoundingRect().top < 0 || obj.getBoundingRect().left < 0) {
4709
- obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top);
4710
- obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left);
4711
- obj.setCoords();
4706
+ if (obj.oCoords.br.x >= obj.canvas.width) {
4707
+ obj.left = obj.left - (obj.oCoords.br.x - obj.canvas.width) - offsetLeft;
4712
4708
  }
4713
- if (obj.getBoundingRect().top + obj.getBoundingRect().height > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width > obj.canvas.width) {
4714
- obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top);
4715
- obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left);
4716
- obj.setCoords();
4709
+ if (obj.oCoords.br.y >= obj.canvas.height) {
4710
+ obj.top = obj.top - (obj.oCoords.br.y - obj.canvas.height) - offsetTop;
4717
4711
  }
4718
- var brNew = obj.getBoundingRect();
4719
- if (brNew.width + brNew.left >= obj.canvas.width || brNew.height + brNew.top >= obj.canvas.height || brNew.left < 0 || brNew.top < 0) ; else {
4720
- left1 = obj.left;
4721
- top1 = obj.top;
4722
- scale1x = obj.scaleX;
4723
- scale1y = obj.scaleY;
4724
- width1 = obj.width;
4725
- height1 = obj.height;
4712
+ if (obj.left - obj.width * obj.scaleX / 2 < 0) {
4713
+ obj.left = offsetLeft + obj.width * obj.scaleX / 2;
4726
4714
  }
4715
+ if (obj.top - obj.height * obj.scaleY / 2 < 0) {
4716
+ obj.top = offsetTop + obj.height * obj.scaleY / 2;
4717
+ }
4718
+ obj.setCoords();
4727
4719
  if (isObjectInCenter(e.target)) {
4728
4720
  use3dddPlus.getState().verticalLine.set({
4729
4721
  visible: true