generated from mirzaev/pot-php
Compare commits
2 Commits
4d2e419018
...
1.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f09b2de71 | |||
| 3ef75a5814 |
Submodule pechatalka.mjs updated: c94542bfd3...4496b0464b
@@ -151,9 +151,6 @@ final class paper extends core
|
|||||||
$image->setImageUnits(imagick::RESOLUTION_PIXELSPERCENTIMETER);
|
$image->setImageUnits(imagick::RESOLUTION_PIXELSPERCENTIMETER);
|
||||||
$image->setimagematte(true);
|
$image->setimagematte(true);
|
||||||
|
|
||||||
// Initializing the layer image height before resizing
|
|
||||||
$before = $image->getImageHeight();
|
|
||||||
|
|
||||||
// Resizing the layer image
|
// Resizing the layer image
|
||||||
$image->adaptiveResizeImage((int) round($blank['width'] * $layer['scale']), 0);
|
$image->adaptiveResizeImage((int) round($blank['width'] * $layer['scale']), 0);
|
||||||
|
|
||||||
@@ -165,10 +162,8 @@ final class paper extends core
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculating the layer image coordinates by the layer image mask
|
// Calculating the layer image coordinates by the layer image mask
|
||||||
$vertical = $blank['height'] - $before;
|
$layer['x'] = (int) round(($layer['x'] - ($canvas['width'] - $layer['width']) / 2) * $ratio['width'] + ($blank['width'] - $image->getImageWidth()) / 2);
|
||||||
$layer['x'] = (int) round($layer['x'] * $ratio['width'] + ($blank['width'] - $image->getImageWidth()) / 2);
|
$layer['y'] = (int) round(($layer['y'] - ($canvas['height'] - $layer['height']) / 2) * $ratio['height'] + ($blank['height'] - $image->getImageHeight()) / 2);
|
||||||
$layer['y'] = (int) round($layer['y'] * $ratio['height'] + ($blank['height'] - $image->getImageHeight() + ($vertical > 0 ? $vertical : 0)) / 2);
|
|
||||||
unset($before, $vertical);
|
|
||||||
|
|
||||||
// Compositing the layer image mask with the layer image
|
// Compositing the layer image mask with the layer image
|
||||||
$image->compositeImage(
|
$image->compositeImage(
|
||||||
@@ -181,15 +176,15 @@ final class paper extends core
|
|||||||
// Drawing the cutting line
|
// Drawing the cutting line
|
||||||
$draw = new imagick_draw();
|
$draw = new imagick_draw();
|
||||||
$draw->setfillcolor($canvas['background'] ?? '#fff');
|
$draw->setfillcolor($canvas['background'] ?? '#fff');
|
||||||
$stroke = 1;
|
$stroke = 2;
|
||||||
$draw->setStrokeOpacity($stroke);
|
$draw->setStrokeOpacity(1);
|
||||||
$draw->setStrokeColor('#000');
|
$draw->setStrokeColor('#000');
|
||||||
$draw->setStrokeWidth(2);
|
$draw->setStrokeWidth($stroke);
|
||||||
$draw->circle(
|
$draw->circle(
|
||||||
$place['x'] + $blank['width'] / 2,
|
$place['x'] + $blank['width'] / 2,
|
||||||
$place['y'] + $blank['height'] / 2,
|
$place['y'] + $blank['height'] / 2,
|
||||||
round($place['x'] + $blank['width'] / 2 - $stroke),
|
round($place['x'] + $blank['width'] / 2 + $stroke),
|
||||||
round($place['y'] + $blank['height'])
|
round($place['y'] + $blank['height'] + $stroke)
|
||||||
);
|
);
|
||||||
$paper->drawimage($draw);
|
$paper->drawimage($draw);
|
||||||
|
|
||||||
|
|||||||
@@ -148,15 +148,20 @@ Object.assign(
|
|||||||
if (typeof index === "number") {
|
if (typeof index === "number") {
|
||||||
// Initialized the layer index
|
// Initialized the layer index
|
||||||
|
|
||||||
// Initializing the layer
|
// Calculating the difference between the canvas and the layer
|
||||||
product[index] ??= {};
|
const difference = {
|
||||||
|
width: canvas.offsetWidth - layer.offsetWidth,
|
||||||
|
height: canvas.offsetHeight - layer.offsetHeight
|
||||||
|
};
|
||||||
|
|
||||||
// Writing the layer parameters
|
// Initializing the layer
|
||||||
product[index].x =
|
product[index] = {
|
||||||
parseInt(layer.style.getPropertyValue("left")) || 0;
|
x: parseInt(layer.style.getPropertyValue("left")) || (difference.width > 0 ? difference.width / 2 : 0),
|
||||||
product[index].y =
|
y: parseInt(layer.style.getPropertyValue("top")) || (difference.height > 0 ? difference.height / 2 : 0),
|
||||||
parseInt(layer.style.getPropertyValue("top")) || 0;
|
width: parseInt(layer.offsetWidth),
|
||||||
product[index].scale = parseFloat(layer.style.getPropertyValue("scale") || 1);
|
height: parseInt(layer.offsetHeight),
|
||||||
|
scale: parseFloat(layer.style.getPropertyValue("scale") || 1)
|
||||||
|
};
|
||||||
|
|
||||||
// Initializing the layer type
|
// Initializing the layer type
|
||||||
const type = layer.getAttribute("data-layer-type");
|
const type = layer.getAttribute("data-layer-type");
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ core.modules.connect(["generator", "pechatalka"])
|
|||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Activating the keyboard function
|
||||||
|
instance.keyboard();
|
||||||
|
|
||||||
|
// Activating the drag and drop function
|
||||||
|
instance.dragdrop();
|
||||||
|
|
||||||
// instence.layers.set('interface', true)
|
// instence.layers.set('interface', true)
|
||||||
|
|
||||||
// Reinitializing the `layer create` event
|
// Reinitializing the `layer create` event
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 117 KiB |
@@ -93,14 +93,31 @@ div#pechatalka {
|
|||||||
position: relative;
|
position: relative;
|
||||||
width: var(--diameter-cut, 300px);
|
width: var(--diameter-cut, 300px);
|
||||||
height: var(--diameter-cut, 300px);
|
height: var(--diameter-cut, 300px);
|
||||||
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
border: 2px solid var(--background-color-inverted);
|
outline: 2px solid var(--background-color-inverted);
|
||||||
background-color: var(--paper, var(--white, #fff));
|
background-color: var(--paper, var(--white, #fff));
|
||||||
|
|
||||||
|
&:is(.drag) {
|
||||||
|
&:before {
|
||||||
|
opacity: 1;
|
||||||
|
background: radial-gradient(1px,
|
||||||
|
transparent calc(var(--diameter-display, 77.08%) / 2),
|
||||||
|
#53decbab);
|
||||||
|
transition: opacity 0s, background 0s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.drag) {
|
||||||
|
&:before {
|
||||||
|
transition: opacity 0.1s ease-out, background 0.1s ease-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -112,7 +129,6 @@ div#pechatalka {
|
|||||||
background: radial-gradient(1px,
|
background: radial-gradient(1px,
|
||||||
transparent calc(var(--diameter-display, 77.08%) / 2),
|
transparent calc(var(--diameter-display, 77.08%) / 2),
|
||||||
#000a);
|
#000a);
|
||||||
transition: opacity 0.1s ease-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:has(div.layer) {
|
&:has(div.layer) {
|
||||||
@@ -153,7 +169,7 @@ div#pechatalka {
|
|||||||
/* min-width: 50%;
|
/* min-width: 50%;
|
||||||
max-width: 200%; */
|
max-width: 200%; */
|
||||||
width: calc(var(--diameter-cut, var(--width, 100%)) + var(--width-zoom, 0px));
|
width: calc(var(--diameter-cut, var(--width, 100%)) + var(--width-zoom, 0px));
|
||||||
height: calc(var(--diameter-cut, var(--width, 100%)) + var(--width-zoom, 0px));
|
/* height: calc(var(--diameter-cut, var(--width, 100%)) + var(--width-zoom, 0px)); */
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
display: flex;
|
display: flex;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
@@ -171,28 +187,29 @@ div#pechatalka {
|
|||||||
}
|
}
|
||||||
|
|
||||||
>button {
|
>button {
|
||||||
&:is(:disabled, [disabled="true"], .disabled) {
|
|
||||||
display: none !important;
|
|
||||||
pointer-events: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:is(.delete) {
|
&:is(.delete) {
|
||||||
--offset: 5px;
|
--offset: 5px;
|
||||||
--size: 40px;
|
--size: 40px;
|
||||||
z-index: 1500;
|
z-index: 1500;
|
||||||
position: fixed;
|
position: absolute;
|
||||||
margin-top: var(--offset);
|
top: calc(var(--vertical-difference, 0px) / 2 + var(--offset, 5px));
|
||||||
margin-left: calc((var(--size, 40px) + var(--offset)) * -1);
|
right: calc(var(--image-right, 0px) + var(--offset, 5px));
|
||||||
width: var(--size, 40px);
|
width: var(--size, 40px);
|
||||||
height: var(--size, 40px);
|
height: var(--size, 40px);
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
mix-blend-mode: overlay;
|
opacity: 1;
|
||||||
|
pointer-events: all;
|
||||||
|
border: unset;
|
||||||
|
background: unset;
|
||||||
|
transition: pointer-events 0s, opacity 0.1s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:is(:disabled, [disabled="true"], .disabled) {
|
||||||
mix-blend-mode: normal;
|
opacity: 0;
|
||||||
}
|
pointer-events: none !important;
|
||||||
|
transition: pointer-events 0s linear 0.1s, opacity 0.1s ease-out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user