@threedddplus/logoeditor 0.0.80 → 0.0.82

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.
@@ -4697,33 +4697,43 @@ var initCanvas = function initCanvas() {
4697
4697
  var onObjectMoving = function onObjectMoving(e) {
4698
4698
  use3dddPlus.getState().updateModifaction(false);
4699
4699
  var obj = e.target;
4700
- var offsetLeft = 10;
4701
- var offsetTop = 20;
4702
- obj.setCoords();
4703
- // var curZoom = obj.canvas.getZoom();
4704
- if (obj.getScaledWidth() > obj.canvas.width) {
4705
- //Objct width is too big
4706
- // obj.scaleToWidth(obj.canvas.width - 100);
4707
- return;
4708
- }
4709
- if (obj.getScaledHeight() > obj.canvas.height) {
4710
- //Objct height is too big
4711
- // obj.scaleToHeight(obj.canvas.height - 100);
4712
- return;
4700
+ if (obj.left < 0 || isNaN(obj.left)) {
4701
+ obj.left = 0;
4713
4702
  }
4714
- if (obj.oCoords.br.x >= obj.canvas.width) {
4715
- obj.left = obj.left - (obj.oCoords.br.x - obj.canvas.width) - offsetLeft;
4703
+ if (obj.top < 0 || isNaN(obj.top)) {
4704
+ obj.top = 0;
4716
4705
  }
4717
- if (obj.oCoords.br.y >= obj.canvas.height) {
4718
- obj.top = obj.top - (obj.oCoords.br.y - obj.canvas.height) - offsetTop;
4706
+ console.log('before set Corrds', e);
4707
+ obj.setCoords();
4708
+ debugger;
4709
+ console.log('after set correds', e);
4710
+ if (obj.getBoundingRect().top < 10 || obj.getBoundingRect().left < 45) {
4711
+ obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top + 10);
4712
+ obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left + 45);
4713
+ obj.setCoords();
4719
4714
  }
4720
- if (obj.left - obj.width * obj.scaleX / 2 < 0) {
4721
- obj.left = offsetLeft + obj.width * obj.scaleX / 2;
4715
+ if (obj.getBoundingRect().top + obj.getBoundingRect().height + 10 > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width + 45 > obj.canvas.width) {
4716
+ obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top - 10);
4717
+ obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left - 45);
4718
+ obj.setCoords();
4722
4719
  }
4723
- if (obj.top - obj.height * obj.scaleY / 2 < 0) {
4724
- obj.top = offsetTop + obj.height * obj.scaleY / 2;
4720
+ var brNew = obj.getBoundingRect();
4721
+ if (brNew.width + brNew.left + 45 >= obj.canvas.width || brNew.height + brNew.top + 10 >= obj.canvas.height || brNew.left < 45 || brNew.top < 10) {
4722
+ console.log(obj.left, obj.top, obj.scaleX, obj.scaleY, obj.width, obj.height);
4723
+ // obj.left = left1;
4724
+ // obj.top = top1;
4725
+ // obj.scaleX = scale1x;
4726
+ // obj.scaleY = scale1y;
4727
+ // obj.width = width1;
4728
+ // obj.height = height1;
4729
+ } else {
4730
+ left1 = obj.left;
4731
+ top1 = obj.top;
4732
+ scale1x = obj.scaleX;
4733
+ scale1y = obj.scaleY;
4734
+ width1 = obj.width;
4735
+ height1 = obj.height;
4725
4736
  }
4726
- obj.setCoords();
4727
4737
  if (isObjectInCenter(e.target)) {
4728
4738
  use3dddPlus.getState().verticalLine.set({
4729
4739
  visible: true