Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13962949
D16665.id40122.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D16665.id40122.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -547,7 +547,6 @@
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
'rsrc/js/core/behavior-badge-view.js' => '8ff5e24c',
'rsrc/js/core/behavior-choose-control.js' => '327a00d1',
- 'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96',
'rsrc/js/core/behavior-device.js' => 'bb1dd507',
@@ -655,7 +654,6 @@
'javelin-behavior-aphlict-listen' => 'fb20ac8d',
'javelin-behavior-aphlict-status' => '5e2634b9',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
- 'javelin-behavior-aphront-crop' => 'fa0f4fc2',
'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22',
'javelin-behavior-aphront-form-disable-on-submit' => '5c54cbf3',
'javelin-behavior-aphront-more' => 'a80d0378',
@@ -2243,12 +2241,6 @@
'javelin-util',
'phabricator-busy',
),
- 'fa0f4fc2' => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-vector',
- 'javelin-magical-init',
- ),
'fb20ac8d' => array(
'javelin-behavior',
'javelin-aphlict',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -305,7 +305,6 @@
'ConpherenceParticipantQuery' => 'applications/conpherence/query/ConpherenceParticipantQuery.php',
'ConpherenceParticipantView' => 'applications/conpherence/view/ConpherenceParticipantView.php',
'ConpherenceParticipationStatus' => 'applications/conpherence/constants/ConpherenceParticipationStatus.php',
- 'ConpherencePicCropControl' => 'applications/conpherence/view/ConpherencePicCropControl.php',
'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php',
'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php',
'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php',
@@ -4782,7 +4781,6 @@
'ConpherenceParticipantQuery' => 'PhabricatorOffsetPagedQuery',
'ConpherenceParticipantView' => 'AphrontView',
'ConpherenceParticipationStatus' => 'ConpherenceConstants',
- 'ConpherencePicCropControl' => 'AphrontFormControl',
'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler',
diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php
--- a/src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -507,10 +507,6 @@
'src' => $crop_uri,
))))
->appendChild(
- id(new ConpherencePicCropControl())
- ->setLabel(pht('Crop Image'))
- ->setValue($image))
- ->appendChild(
id(new ConpherenceFormDragAndDropUploadControl())
->setLabel(pht('Change Image')));
} else {
diff --git a/src/applications/conpherence/view/ConpherencePicCropControl.php b/src/applications/conpherence/view/ConpherencePicCropControl.php
deleted file mode 100644
--- a/src/applications/conpherence/view/ConpherencePicCropControl.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-final class ConpherencePicCropControl extends AphrontFormControl {
-
- protected function getCustomControlClass() {
- return 'aphront-form-crop';
- }
-
- protected function renderInput() {
- $width = ConpherenceImageData::CROP_WIDTH;
- $height = ConpherenceImageData::CROP_HEIGHT;
-
- $file = $this->getValue();
-
- if ($file === null) {
- return phutil_tag(
- 'img',
- array(
- 'src' => PhabricatorUser::getDefaultProfileImageURI(),
- ),
- '');
- }
-
- $c_id = celerity_generate_unique_node_id();
- $metadata = $file->getMetadata();
- $scale = PhabricatorImageTransformer::getScaleForCrop(
- $file,
- $width,
- $height);
-
- Javelin::initBehavior(
- 'aphront-crop',
- array(
- 'cropBoxID' => $c_id,
- 'width' => $width,
- 'height' => $height,
- 'scale' => $scale,
- 'imageH' => $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT],
- 'imageW' => $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH],
- ));
-
- return javelin_tag(
- 'div',
- array(
- 'id' => $c_id,
- 'sigil' => 'crop-box',
- 'mustcapture' => true,
- 'class' => 'crop-box',
- ),
- array(
- javelin_tag(
- 'img',
- array(
- 'src' => $file->getBestURI(),
- 'class' => 'crop-image',
- 'sigil' => 'crop-image',
- ),
- ''),
- javelin_tag(
- 'input',
- array(
- 'type' => 'hidden',
- 'name' => 'image_x',
- 'sigil' => 'crop-x',
- ),
- ''),
- javelin_tag(
- 'input',
- array(
- 'type' => 'hidden',
- 'name' => 'image_y',
- 'sigil' => 'crop-y',
- ),
- ''),
- ));
- }
-
-}
diff --git a/webroot/rsrc/js/core/behavior-crop.js b/webroot/rsrc/js/core/behavior-crop.js
deleted file mode 100644
--- a/webroot/rsrc/js/core/behavior-crop.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * @provides javelin-behavior-aphront-crop
- * @requires javelin-behavior
- * javelin-dom
- * javelin-vector
- * javelin-magical-init
- */
-
- JX.behavior('aphront-crop', function(config) {
-
- var dragging = false;
- var startX, startY;
- var finalX, finalY;
-
- var cropBox = JX.$(config.cropBoxID);
- var basePos = JX.$V(cropBox);
- cropBox.style.height = config.height + 'px';
- cropBox.style.width = config.width + 'px';
- var baseD = JX.$V(config.width, config.height);
-
- var image = JX.DOM.find(cropBox, 'img', 'crop-image');
- image.style.height = (config.imageH * config.scale) + 'px';
- image.style.width = (config.imageW * config.scale) + 'px';
- var imageD = JX.$V(
- config.imageW * config.scale,
- config.imageH * config.scale
- );
- var minLeft = baseD.x - imageD.x;
- var minTop = baseD.y - imageD.y;
-
- var ondrag = function(e) {
- e.kill();
- dragging = true;
- var p = JX.$V(e);
- startX = p.x;
- startY = p.y;
- };
-
- var onmove = function(e) {
- if (!dragging) {
- return;
- }
- e.kill();
-
- var p = JX.$V(e);
- var dx = startX - p.x;
- var dy = startY - p.y;
- var imagePos = JX.$V(image);
- var moveLeft = imagePos.x - basePos.x - dx;
- var moveTop = imagePos.y - basePos.y - dy;
-
- image.style.left = Math.min(Math.max(minLeft, moveLeft), 0) + 'px';
- image.style.top = Math.min(Math.max(minTop, moveTop), 0) + 'px';
-
- // reset these; a new beginning!
- startX = p.x;
- startY = p.y;
-
- // save off where we are right now
- imagePos = JX.$V(image);
- finalX = Math.abs(imagePos.x - basePos.x);
- finalY = Math.abs(imagePos.y - basePos.y);
- JX.DOM.find(cropBox, 'input', 'crop-x').value = finalX;
- JX.DOM.find(cropBox, 'input', 'crop-y').value = finalY;
- };
-
- var ondrop = function() {
- if (!dragging) {
- return;
- }
- dragging = false;
- };
-
- // NOTE: Javelin does not dispatch mousemove by default.
- JX.enableDispatch(cropBox, 'mousemove');
-
- JX.DOM.listen(cropBox, 'mousedown', [], ondrag);
- JX.DOM.listen(cropBox, 'mousemove', [], onmove);
- JX.DOM.listen(cropBox, 'mouseup', [], ondrop);
- JX.DOM.listen(cropBox, 'mouseout', [], ondrop);
-
-});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 16 2024, 1:09 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717576
Default Alt Text
D16665.id40122.diff (7 KB)
Attached To
Mode
D16665: Remove Crop Image from Conpherence Edit UI
Attached
Detach File
Event Timeline
Log In to Comment