Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Miłosz Sobczak
image-mask-cropper
Commits
69cab8a4
Commit
69cab8a4
authored
8 years ago
by
Miłosz Sobczak
Browse files
Options
Download
Email Patches
Plain Diff
detetcing in change crop is made by user or not
parent
17f80e25
master
1.5.4
1.5.3
v1.5.12
v1.5.11
v1.5.10
v1.5.9
v1.5.8
v1.5.7
v1.5.6
v1.5.5
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.9
v1.4.8
v1.4.7
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
bower.json
+1
-1
bower.json
dist/image-mask-cropper.js
+28
-23
dist/image-mask-cropper.js
dist/image-mask-cropper.min.js
+1
-1
dist/image-mask-cropper.min.js
package.json
+1
-1
package.json
src/image-mask-cropper.js
+28
-23
src/image-mask-cropper.js
with
59 additions
and
49 deletions
+59
-49
bower.json
View file @
69cab8a4
{
"name"
:
"image-mask-cropper"
,
"version"
:
"1.4.
6
"
,
"version"
:
"1.4.
7
"
,
"homepage"
:
"http://gl.pixers.pl:8080/milosz.sobczak/image-mask-cropper/tree/master"
,
"authors"
:
[
"milosz.sobczak@pixers.pl"
...
...
This diff is collapsed.
Click to expand it.
dist/image-mask-cropper.js
View file @
69cab8a4
...
...
@@ -83,6 +83,7 @@
this
.
cropZone
=
Object
.
create
(
elementObject
);
this
.
isRunning
=
false
;
this
.
_isUser
=
false
;
this
.
_init
()
return
this
;
...
...
@@ -248,9 +249,7 @@
}
}
this
.
options
.
onMoveCrop
({
coords
:
this
.
getCropPosition
()
});
this
.
_triggerMoveFunc
();
},
/**
* Setter.
...
...
@@ -300,6 +299,20 @@
this
.
options
.
enableCrop
=
false
;
this
.
_updateContainerClass
();
},
/**
* Triggers callback func when crop is moved.
* @return {void}
*/
_triggerMoveFunc
:
function
()
{
var
self
=
this
;
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
(),
isUser
:
self
.
_isUser
});
}
},
/**
* Refresh whole scene based on configuration.
* @return {void}
...
...
@@ -316,6 +329,8 @@
}
};
this
.
_isUser
=
false
;
if
(
this
.
_isContainerExistingInDom
()
===
false
)
{
this
.
_createContainerDOMElement
();
}
...
...
@@ -383,11 +398,7 @@
this
.
element
.
$element
.
on
(
'
imageMaskCropper:moveCurrentCrop
'
,
function
(
e
,
diffPercentCoords
)
{
self
.
setPositionCoords
(
diffPercentCoords
);
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
self
.
_triggerMoveFunc
();
});
},
/**
...
...
@@ -501,6 +512,8 @@
* @return {void}
*/
_moveCropZoneOrImage
:
function
(
startPosCSS
,
diff
)
{
this
.
_isUser
=
true
;
if
(
this
.
isRunning
===
true
)
{
throw
new
Error
(
'
Plugin is still running. Can
\'
t move.
'
);
}
...
...
@@ -527,11 +540,8 @@
countedValue
=
this
.
_getLeftPercentOfContainer
(
startPosCSS
.
left
-
diffCoords
.
x
);
this
.
_setPositionLeftOfImageMain
(
countedValue
);
}
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
this
.
_triggerMoveFunc
();
},
/**
* Moves crop above imageMain.
...
...
@@ -546,11 +556,7 @@
this
.
_setPositionCoordsY
(
this
.
_getTopPercentOfContainer
(
startPosCSS
.
top
-
diffCoords
.
y
));
this
.
_setPositionOfCropZone
();
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
this
.
_triggerMoveFunc
();
},
/**
* Gets percent of container's height.
...
...
@@ -1135,8 +1141,7 @@
return
result
;
})(),
options
);
window
.
maskCropperInstance
=
self
.
maskCropperInstance
=
new
imageMaskCropper
(
settings
,
self
);
self
.
maskCropperInstance
=
new
imageMaskCropper
(
settings
,
self
);
return
this
.
maskCropperInstance
;
};
/**
...
...
@@ -1155,8 +1160,8 @@
maskOptions
:
{
left
:
0
,
top
:
0
,
width
:
8
0
,
height
:
8
0
width
:
10
0
,
height
:
10
0
},
/**
* Initial coords.
...
...
@@ -1164,7 +1169,7 @@
*/
positionCoords
:
{
x
:
0
,
y
:
2
0
y
:
0
},
enableCrop
:
true
,
maxContainerMargin
:
false
,
...
...
This diff is collapsed.
Click to expand it.
dist/image-mask-cropper.min.js
View file @
69cab8a4
This diff is collapsed.
Click to expand it.
package.json
View file @
69cab8a4
{
"name"
:
"image-mask-cropper"
,
"description"
:
"Jquery library that gives you ability to move images across container using mask as well"
,
"version"
:
"1.4.
6
"
,
"version"
:
"1.4.
7
"
,
"author"
:
"Miłosz Sobczak <milosz.sobczak@pixers.pl>"
,
"devDependencies"
:
{
"
gulp
"
:
"
3.9.0
"
,
...
...
This diff is collapsed.
Click to expand it.
src/image-mask-cropper.js
View file @
69cab8a4
...
...
@@ -83,6 +83,7 @@
this
.
cropZone
=
Object
.
create
(
elementObject
);
this
.
isRunning
=
false
;
this
.
_isUser
=
false
;
this
.
_init
()
return
this
;
...
...
@@ -248,9 +249,7 @@
}
}
this
.
options
.
onMoveCrop
({
coords
:
this
.
getCropPosition
()
});
this
.
_triggerMoveFunc
();
},
/**
* Setter.
...
...
@@ -300,6 +299,20 @@
this
.
options
.
enableCrop
=
false
;
this
.
_updateContainerClass
();
},
/**
* Triggers callback func when crop is moved.
* @return {void}
*/
_triggerMoveFunc
:
function
()
{
var
self
=
this
;
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
(),
isUser
:
self
.
_isUser
});
}
},
/**
* Refresh whole scene based on configuration.
* @return {void}
...
...
@@ -316,6 +329,8 @@
}
};
this
.
_isUser
=
false
;
if
(
this
.
_isContainerExistingInDom
()
===
false
)
{
this
.
_createContainerDOMElement
();
}
...
...
@@ -383,11 +398,7 @@
this
.
element
.
$element
.
on
(
'
imageMaskCropper:moveCurrentCrop
'
,
function
(
e
,
diffPercentCoords
)
{
self
.
setPositionCoords
(
diffPercentCoords
);
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
self
.
_triggerMoveFunc
();
});
},
/**
...
...
@@ -501,6 +512,8 @@
* @return {void}
*/
_moveCropZoneOrImage
:
function
(
startPosCSS
,
diff
)
{
this
.
_isUser
=
true
;
if
(
this
.
isRunning
===
true
)
{
throw
new
Error
(
'
Plugin is still running. Can
\'
t move.
'
);
}
...
...
@@ -527,11 +540,8 @@
countedValue
=
this
.
_getLeftPercentOfContainer
(
startPosCSS
.
left
-
diffCoords
.
x
);
this
.
_setPositionLeftOfImageMain
(
countedValue
);
}
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
this
.
_triggerMoveFunc
();
},
/**
* Moves crop above imageMain.
...
...
@@ -546,11 +556,7 @@
this
.
_setPositionCoordsY
(
this
.
_getTopPercentOfContainer
(
startPosCSS
.
top
-
diffCoords
.
y
));
this
.
_setPositionOfCropZone
();
if
(
typeof
self
.
options
.
onMoveCrop
===
'
function
'
)
{
self
.
options
.
onMoveCrop
.
call
(
self
,
{
coords
:
self
.
getCropPosition
()
});
}
this
.
_triggerMoveFunc
();
},
/**
* Gets percent of container's height.
...
...
@@ -1135,8 +1141,7 @@
return
result
;
})(),
options
);
window
.
maskCropperInstance
=
self
.
maskCropperInstance
=
new
imageMaskCropper
(
settings
,
self
);
self
.
maskCropperInstance
=
new
imageMaskCropper
(
settings
,
self
);
return
this
.
maskCropperInstance
;
};
/**
...
...
@@ -1155,8 +1160,8 @@
maskOptions
:
{
left
:
0
,
top
:
0
,
width
:
8
0
,
height
:
8
0
width
:
10
0
,
height
:
10
0
},
/**
* Initial coords.
...
...
@@ -1164,7 +1169,7 @@
*/
positionCoords
:
{
x
:
0
,
y
:
2
0
y
:
0
},
enableCrop
:
true
,
maxContainerMargin
:
false
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help